Espacios de nombres
Variantes
Acciones

std::ios_base::iostate

De cppreference.com
< cpp‎ | io‎ | ios base
 
 
Biblioteca de E/S
Manipuladores de E/S
E/S estilo C
Búferes
(en desuso en C++98)
Flujos
Abstracciones
E/S de archivos
E/S de cadenas
E/S de arrays
(en desuso en C++98)
(en desuso en C++98)
(en desuso en C++98)
Salida sincronizada
Tipos
Interfaz de categoría de error
(C++11)
 
 
typedef /*implementation defined*/ iostate;
static constexpr iostate goodbit = 0;
static constexpr iostate badbit = /*implementation defined*/

static constexpr iostate failbit = /*implementation defined*/

static constexpr iostate eofbit = /*implementation defined*/
Especifica los indicadores de flujo del Estado. Es un BitmaskType, las constantes se definen los siguientes:
Original:
Specifies stream state flags. It is a BitmaskType, the following constants are defined:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Constante Explicación
goodbit No hay error.
badbit Error de flujo no recuperable.
failbit Operación de entrada/salida fallida (error de formateo o extracción).
eofbit La secuencia de entrada asociada ha alcanzado el fin de archivo.

Contenido

[editar] El eofbit

El eofbit es fijado por las funciones de la librería estándar siguientes:
Original:
The eofbit is set by the following standard library functions:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • La cadena de entrada std::getline función de si se completa al alcanzar el final de la secuencia, en lugar de alcanzar el carácter de terminación especificada .
    Original:
    The string input function std::getline if it completes by reaching the end of the stream, as opposed to reaching the specified terminating character.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Las sobrecargas de entrada numéricos de basic_istream::operator>> si el final de la secuencia se encontró mientras lee el siguiente carácter, en la etapa 2 del proceso num_get::get. Según el estado de análisis sintáctico, failbit puede o no se puede establecer al mismo tiempo: por ejemplo, int n; istringstream buf("1"); buf >> n; conjuntos eofbit, pero no failbit: la 1 entero se ha analizado correctamente y almacenado en n. Por otro lado, bool b; istringstream buf("tr"); buf >> boolalpha >> b; establece tanto eofbit y failbit: no había suficientes caracteres para completar el análisis de la true booleano .
    Original:
    The numeric input overloads of basic_istream::operator>> if the end of the stream was encountered while reading the next character, on Stage 2 of num_get::get processing. Depending on the parsing state, failbit may or may not be set at the same time: for example, int n; istringstream buf("1"); buf >> n; sets eofbit, but not failbit: the integer 1 was successfully parsed and stored in n. On the other hand, bool b; istringstream buf("tr"); buf >> boolalpha >> b; sets both eofbit and failbit: there was not enough characters to complete the parsing of the boolean true.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Las sobrecargas de extracción de caracteres de operator>>std::basic_istream, si el final de la secuencia se alcanza antes el límite (si alguna) en el número de caracteres a ser extraídos .
    Original:
    The character extraction overloads of operator>>std::basic_istream, if the end of the stream is reached before the limit (if any) on the number of characters to be extracted.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • El std::get_time I / O manipulador y cualquiera de las funciones de análisis std::time_get: time_get::get, time_get::get_time, time_get::get_date, etc, si el final de la secuencia se alcanza antes de que el último carácter necesario para analizar el esperado valor fecha / hora se procesó .
    Original:
    The std::get_time I/O manipulator and any of the std::time_get parsing functions: time_get::get, time_get::get_time, time_get::get_date, etc., if the end of the stream is reached before the last character needed to parse the expected date/time value was processed.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • El std::get_money I / O manipulador y función money_get::get, si el final de la secuencia se alcanza antes de que el último carácter necesario para analizar el valor monetario esperado se procesó .
    Original:
    The std::get_money I/O manipulator and money_get::get function, if the end of the stream is reached before the last character needed to parse the expected monetary value was processed.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • El constructor basic_istream::sentry, ejecute al comienzo de cada función de entrada con formato: a menos que el bit skipws no está definido (por ejemplo, mediante la emisión de std::noskipws), centinela lee y descarta los principales espacios en blanco. Si el final de la secuencia de entrada se alcanza durante esta operación, tanto eofbit y failbit están definidas, y hay entrada tiene lugar .
    Original:
    The basic_istream::sentry constructor, executed at the beginning of every formatted input function: unless the skipws bit is unset (e.g. by issuing std::noskipws), sentry reads and discards the leading whitespace characters. If the end of the input stream is reached during this operation, both eofbit and failbit are set, and no input takes place.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • El std::ws manipulador de E / S, si se alcanza el final de la secuencia mientras que consume espacio en blanco (pero, a diferencia del centinela de entrada con formato, que no establece failbit en este caso)
    Original:
    The I/O manipulator std::ws, if it reaches the end of the stream while consuming whitespace (but, unlike the formatted input sentry, it does not set failbit in this case)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Las funciones de entrada sin formato basic_istream::read, basic_istream::get, y basic_istream::getline, cuando se alcanza el final de la secuencia .
    Original:
    The unformatted input functions basic_istream::read, basic_istream::get, and basic_istream::getline, when reaching the end of the stream.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • La entrada de descarte basic_istream::ignore función, cuando se alcanza el final de la secuencia antes de alcanzar el carácter delimitador especificado .
    Original:
    The discard input function basic_istream::ignore, when reaching the end of the stream before reaching the specified delimiter character.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • La entrada basic_istream::readsome función inmediata, si vuelve basic_streambuf::in_avail -1
    Original:
    The immediate input function basic_istream::readsome, if basic_streambuf::in_avail returns -1
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Las siguientes funciones borrar eofbit como un efecto secundario:
Original:
The following functions clear eofbit as a side-effect:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] El failbit

El failbit es fijado por las funciones de la librería estándar siguientes:
Original:
The failbit is set by the following standard library functions:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] El badbit

El badbit es fijado por las funciones de la librería estándar siguientes:
Original:
The badbit is set by the following standard library functions:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Ejemplo

[editar] Ver también

ios_base::iostate flags basic_ios accessors
eofbit failbit badbit good() fail() bad() eof() operator bool() operator!()
false false false true false false false true false
false false true false true true false false true
false true false false true false false false true
false true true false true true false false true
true false false false false false true true false
true false true false true true true false true
true true false false true false true false true
true true true false true true true false true