std::basic_ifstream::basic_ifstream - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
|
|
(1) | |
|
|
(2) | |
|
|
(3) | (desde C++11) |
|
|
(4) | (desde C++11) |
|
|
(5) | |
Constrói fluxo de arquivo novo.
Original:
Constructs new file stream.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Construtor padrão: constrói um fluxo que não está associado a um arquivo: default-constrói a std::basic_filebuf e constrói a base com o ponteiro para esse membro padrão construído std::basic_filebuf.
Original:
Default constructor: constructs a stream that is not associated with a file: default-constructs the std::basic_filebuf and constructs the base with the pointer to this default-constructed std::basic_filebuf member.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Primeiro, executa os mesmos passos que o construtor padrão, então asssociate o fluxo com um arquivo chamando rdbuf()->open(filename, mode | std::ios_base::in).. Se a chamada open () retorna um ponteiro nulo, define setstate(failbit).
Original:
First, performs the same steps as the default constructor, then asssociate the stream with a file by calling rdbuf()->open(filename, mode | std::ios_base::in).. If the open() call returns a null pointer, sets setstate(failbit).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
Mesmo que basic_ifstream(filename.c_str(), mode).
Original:
Same as basic_ifstream(filename.c_str(), mode).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Mova construtor. Primeiro, mover-constrói a classe base de other (que não afeta o ponteiro rdbuf()), em seguida, passar-constrói o membro std::basic_filebuf, em seguida, chama this->set_rdbuf() para instalar o novo basic_filebuf como o ponteiro rdbuf() na classe base.
Original:
Move constructor. First, move-constructs the base class from other (which does not affect the rdbuf() pointer), then move-constructs the std::basic_filebuf member, then calls this->set_rdbuf() to install the new basic_filebuf as the rdbuf() pointer in the base class.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
O construtor de cópia é apagado: esta classe não é copiável.
Original:
The copy-constructor is deleted: this class is not copyable.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Parâmetros
| filename | - | o nome do arquivo a ser aberto Original: the name of the file to be opened The text has been machine-translated via Google Translate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mode | - | especifica o modo de fluxo aberto. Ele é o tipo de máscara de bits, as seguintes constantes são definidas:
Original: specifies stream open mode. It is bitmask type, the following constants are defined:
The text has been machine-translated via Google Translate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| other | - | outro fluxo de arquivo para usar como fonte Original: another file stream to use as source The text has been machine-translated via Google Translate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Exemplo
#include <fstream> #include <utility> #include <string> int main() { std::ifstream f0; std::ifstream f1("test.bin", std::ios::binary); std::string name = "example.txt"; std::ifstream f2(name); std::ifstream f3(std::move(f1)); }
Veja também
abre um arquivo e associa com o fluxo Original: opens a file and associates it with the stream The text has been machine-translated via Google Translate. (função pública membro) [edit] | |
abre um arquivo e configura como a seqüência de caracteres associado Original: opens a file and configures it as the associated character sequence The text has been machine-translated via Google Translate. (of std::basic_filebuf função pública membro) [edit]
| |
substitui o Original: replaces the The text has been machine-translated via Google Translate. (protegido função de membro) [edit] | |
Constrói o objeto Original: constructs the object The text has been machine-translated via Google Translate. (of std::basic_istream função pública membro) [edit]
| |