std::basic_streambuf::underflow
Aus cppreference.com
< cpp | io | basic streambuf
![]() | 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. |
int_type underflow(); | ||
Stellt sicher, dass mindestens ein Zeichen verfügbar ist im Eingangsbereich durch die Aktualisierung der Zeiger auf den Eingangsbereich (falls erforderlich). Gibt den Wert dieser Zeichen auf Erfolg oder traits::eof() bei Ausfall .
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.
Die Funktion kann zu aktualisieren
gptr
, egptr
und eback
Zeigern auf den Standort der neu geladenen Daten (sofern vorhanden) zu definieren. Bei Ausfall sorgt die Funktion, dass entweder gptr()== nullptr oder 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.
Die Basisklasse Version der Funktion tut nichts. Die abgeleiteten Klassen können diese Funktion überschreiben, um Aktualisierungen der get-Bereich im Falle der Erschöpfung ermöglichen .
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.
Inhaltsverzeichnis |
[Bearbeiten]Parameter
(None)
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.
[Bearbeiten]Rückgabewert
Der Wert des Zeichens, auf die der get-Zeiger nach dem Anruf bei Erfolg oder traits::eof() sonst .
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.
Die Basisklasse Version der Funktion nennt 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.
[Bearbeiten]Hinweis
Die öffentlichen Funktionen std::streambuf rufen Sie diese Funktion nur, wenn gptr()== nullptr oder 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.
[Bearbeiten]Beispiel
#include <iostream>#include <sstream> class null_filter_buf :publicstd::streambuf{std::streambuf* src;char ch;// single-byte bufferprotected:int underflow(){while((ch= src->sbumpc())=='\0');// skip zeroes setg(&ch, &ch, &ch+1);// make one read position availablereturn 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);}
Output:
This is an example
[Bearbeiten]Siehe auch
[virtuell] | liest Zeichen aus dem dazugehörigen Eingang Sequenz an die get-Bereich und Fortschritte der nächste Zeiger Original: reads characters from the associated input sequence to the get area and advances the next pointer The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (virtuellen geschützten Member-Funktion) |
[virtuell] | schreibt Zeichen auf die zugehörige Ausgangsscheibe Sequenz aus dem Bereich gebracht Original: writes characters to the associated output sequence from the put area The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (virtuellen geschützten Member-Funktion) |