std::basic_filebuf::is_open
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
bool is_open() const; |
||
Devoluciones
true si la llamada más reciente a open() éxito y no ha habido ninguna llamada a close() desde entonces .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.
Parámetros
(Ninguno)
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.
Valor de retorno
true si el archivo asociado está abierto, false de otra manera .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.
Notas
Esta función se suele llamar por
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.
Ejemplo
Ejecuta este código
#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';
}
Salida:
direct call: true
through streambuf: true
through fstream: true
Ver también
| Abre un archivo y lo configura como la secuencia de caracteres asociada. (función miembro pública) | |
vacía el búfer área de poner y cierra el archivo asociado 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. (función miembro pública) |