std::basic_filebuf::is_open
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> bool is_open() const; |
||
Retours
true si l'appel le plus récent à open() réussi et il n'y a pas eu d'appel à close() depuis lors .Original:
Returns
true if the most recent call to open() succeeded and there has been no call to close() since then.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Paramètres
(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.
You can help to correct and verify the translation. Click here for instructions.
Retourne la valeur
true si le fichier associé est ouvert, false autrement .Original:
true if the associated file is open, false otherwise.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Notes
Cette fonction est généralement appelée par
std::basic_fstream::is_open .Original:
This function is typically called by
std::basic_fstream::is_open.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Exemple
#include <fstream>
#include <iostream>
int main()
{
std::ifstream fs("test.txt");
std::filebuf fb;
fb.open("test.txt", std::ios_base::in);
std::cout << std::boolalpha
<< "direct call: " << fb.is_open() << '\n'
<< "through streambuf: " << fs.rdbuf()->is_open() << '\n'
<< "through fstream: " << fs.is_open() << '\n';
}
Résultat :
direct call: true
through streambuf: true
through fstream: true
Voir aussi
ouvre un fichier et le configure comme la séquence de caractères associé Original: opens a file and configures it as the associated character sequence 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) | |
le tampon des mises région et ferme le fichier associé Original: flushes the put area buffer and 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) | |