◐ Shell
clean mode source ↗

std::basic_fstream::open — cppreference.com

De cppreference.com

<metanoindex/>

<tbody> </tbody>

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

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

(depuis C++11)

S'ouvre et associés de fichiers avec le flux de fichier. Appels clear() en cas de succès ou d'échec .. setstate(failbit) sur

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.

La première version efficacement appelle rdbuf()->open(filename, mode).

Original:

The first version effectively calls rdbuf()->open(filename, mode).

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

La deuxième version efficacement appelle 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.

Paramètres

filename -

le nom du fichier à ouvrir

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 -

spécifie le mode de flux ouvert. Il est de type masque, les constantes suivantes sont définies:

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

demander à l'extrémité du flux avant chaque écriture

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

ouvrir en mode binaire

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

ouvrir en lecture

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

ouvrir en écriture

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

jeter le contenu du courant lors de l'ouverture

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

demander à l'extrémité du flux immédiatement après ouverture

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

demander à l'extrémité du flux avant chaque écriture

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

ouvrir en mode binaire

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

ouvrir en lecture

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

ouvrir en écriture

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

jeter le contenu du courant lors de l'ouverture

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

demander à l'extrémité du flux immédiatement après ouverture

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.

Retourne la valeur

(Aucun)

Original:

(none)

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

Exemple

Voir aussi

vérifie si le flux a un fichier associé

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.


(fonction membre publique) [edit]

ferme le fichier associé

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.


(fonction membre publique) [edit]