◐ Shell
clean mode source ↗

std::basic_ifstream::open - cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

void open( const char *filename, ios_base::openmode mode = ios_base::in );

void open( const std::string &filename, ios_base::openmode mode = ios_base::in );

(desde C++11)

Abre e associados arquivo com o fluxo de arquivo. clear() chama de sucesso ou fracasso em setstate(failbit).

Original:

Opens and associates file with the file stream. Calls clear() on success or setstate(failbit) on failure.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

A primeira versão efetivamente chama rdbuf()->open(filename, mode | ios_base::in).

Original:

The first version effectively calls rdbuf()->open(filename, mode | ios_base::in).

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

A segunda versão efetivamente chama open(filename.c_str(), mode).

Original:

The second version effectively calls open(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.

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.
You can help to correct and verify the translation. Click here for instructions.

mode -

especifica o modo de fluxo aberto. Ele é o tipo de máscara de bits, as seguintes constantes são definidas:

Constante

Original:

Constant

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Explanation
app

procurar o fim do fluxo antes de cada gravação

Original:

seek to the end of stream before each write

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

binary

abrir em modo binário

Original:

open in binary mode

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

in

Abrir para leitura

Original:

open for reading

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

out

abrir para escrita

Original:

open for writing

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

trunc

descartar o conteúdo da corrente durante a abertura

Original:

discard the contents of the stream when opening

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

ate

procurar o fim do fluxo imediatamente depois de aberto

Original:

seek to the end of stream immediately after open

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Original:

specifies stream open mode. It is bitmask type, the following constants are defined:

Constante

Original:

Constant

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Explanation
app

procurar o fim do fluxo antes de cada gravação

Original:

seek to the end of stream before each write

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

binary

abrir em modo binário

Original:

open in binary mode

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

in

Abrir para leitura

Original:

open for reading

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

out

abrir para escrita

Original:

open for writing

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

trunc

descartar o conteúdo da corrente durante a abertura

Original:

discard the contents of the stream when opening

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

ate

procurar o fim do fluxo imediatamente depois de aberto

Original:

seek to the end of stream immediately after open

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Valor de retorno

(Nenhum)

Original:

(none)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Exemplo

Veja também

Verifica se o fluxo tem um arquivo associado

Original:

checks if the stream has an associated file

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]

fecha o arquivo associado

Original:

closes the associated file

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.


(função pública membro) [edit]