std::basic_streambuf<CharT,Traits>::underflow
De cppreference.com
< cpp | io | basic streambuf
![]() |
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í. |
int_type underflow(); |
||
Se asegura de que al menos un carácter está disponible en el área de entrada mediante la actualización de los punteros a la zona de entrada (si es necesario). Devuelve el valor de ese carácter en el éxito o en el fracaso traits::eof() .
Original:
Ensures that at least one character is available in the input area by updating the pointers to the input area (if needed). Returns the value of that character on success or traits::eof() on failure.
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.
La función puede actualizar
gptr
, egptr
y eback
punteros para definir la ubicación de los datos recién cargados (si los hay). En caso de fallo, la función se asegura de que sea gptr() == nullptr o gptr() == egptr .Original:
The function may update
gptr
, egptr
and eback
pointers to define the location of newly loaded data (if any). On failure, the function ensures that either gptr() == nullptr or gptr() == egptr.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.
La versión de la clase base de la función no hace nada. Las clases derivadas pueden reemplazar esta función para permitir las actualizaciones del área get en el caso de agotamiento .
Original:
The base class version of the function does nothing. The derived classes may override this function to allow updates to the get area in the case of exhaustion.
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.
Contenido |
[editar] 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.
[editar] Valor de retorno
El valor del carácter al que apunta el puntero del' llegar después de la llamada en caso de éxito, o de lo contrario traits::eof() .
Original:
The value of the character pointed to by the get pointer after the call on success, or traits::eof() 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.
La versión de la clase base de la función llama traits::eof() .
Original:
The base class version of the function calls traits::eof().
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.
[editar] Nota
Las funciones públicas de std::streambuf llamar a esta función sólo si gptr() == nullptr o gptr() >= egptr() .
Original:
The public functions of std::streambuf call this function only if gptr() == nullptr or gptr() >= egptr().
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.
[editar] Ejemplo
Ejecuta este código
#include <iostream> #include <sstream> class null_filter_buf : public std::streambuf { std::streambuf* src; char ch; // single-byte buffer protected: int underflow() { while( (ch= src->sbumpc()) == '\0') ; // skip zeroes setg(&ch, &ch, &ch+1); // make one read position available return ch; // may return EOF } public: null_filter_buf(std::streambuf* buf) : src(buf) { setg(&ch, &ch+1, &ch+1); // buffer is initially full } }; void filtered_read(std::istream& in) { std::streambuf* orig = in.rdbuf(); null_filter_buf buf(orig); in.rdbuf(&buf); for(char c; in.get(c); ) std::cout << c; in.rdbuf(orig); } int main() { char a[] = "This i\0s \0an e\0\0\0xample"; std::istringstream in(std::string(std::begin(a), std::end(a))); filtered_read(in); }
Salida:
This is an example
[editar] Ver también
[virtual] |
Lee los caracteres de la secuencia de entrada asociada a la zona de obtención y avanza el puntero siguiente. (función miembro virtual protegida) |
[virtual] |
Escribe los caracteres del área de colocación a la secuencia de salida asociada. (función miembro virtual protegida) |