std::basic_istream::get
Aus 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> int_type get(); |
(1) | |
basic_istream& get( char_type& ch ); |
(2) | |
basic_istream& get( char_type* s, std::streamsize count ); |
(3) | |
basic_istream& get( char_type* s, std::streamsize count, char_type delim ); |
(4) | |
basic_istream& get( basic_streambuf& strbuf ); |
(5) | |
basic_istream& get( basic_streambuf& strbuf, char_type delim ); |
(6) | |
Extrahiert Zeichen oder Zeichen von stream .
Original:
Extracts character or characters from stream.
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.
Alle Versionen verhalten sich wie
UnformattedInputFunctions. Nach dem Bau und Prüfung der Schildwache Objekt, führen diese Funktionen wie folgt vor:Original:
All versions behave as
UnformattedInputFunctions. After constructing and checking the sentry object, these functions perform the following: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.
1)
liest ein Zeichen und gibt es, falls verfügbar. Ansonsten kehrt
Traits::eof() und setzt failbit und eofbit .Original:
reads one character and returns it if available. Otherwise, returns
Traits::eof() and sets failbit and eofbit.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.
2)
ein Zeichen liest und speichert sie in
ch falls vorhanden. Ansonsten lässt ch unverändert und setzt failbit und eofbit. Beachten Sie, dass diese Funktion nicht auf den Typen überlastet signed char und unsigned char, im Gegensatz zu den formatierten Eingabe von Zeichen operator >> .Original:
reads one character and stores it to
ch if available. Otherwise, leaves ch unmodified and sets failbit and eofbit. Note that this function is not overloaded on the types signed char and unsigned char, unlike the formatted character input operator>>.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.
3)
wie
get(s, count, widen('\n')), das heißt, liest höchstens count-1 Zeichen und speichert sie in Zeichenkette, auf die s bis '\n' gefunden .Original:
same as
get(s, count, widen('\n')), that is, reads at most count-1 characters and stores them into character string pointed to by s until '\n' is found.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.
4)
liest Zeichen und speichert sie in den aufeinanderfolgenden Stellen des Zeichen-Array, dessen erstes Element wird durch
s hingewiesen. Zeichen werden extrahiert und gespeichert, bis eine der folgenden Situationen eintritt:Original:
reads characters and stores them into the successive locations of the character array whose first element is pointed to by
s. Characters are extracted and stored until any of the following occurs: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.
- n-1 Zeichen gespeichert wurdenOriginal:n-1 characters have been storedThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- Ende der Datei auftritt in der Eingabesequenz (
setstate(eofbit)genannt wird)Original:end of file condition occurs in the input sequence (setstate(eofbit)is called)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- die nächste verfügbare Eingabezeichen
cgleichdelim, wieTraits::eq(c, delim)bestimmt. Dieses Zeichen wird nicht extrahiert (im Gegensatz basic_istream::getline())Original:the next available input charactercequalsdelim, as determined byTraits::eq(c, delim). This character is not extracted (unlike basic_istream::getline())The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn keine Zeichen extrahiert wurden, ruft
setstate(failbit). In jedem Fall, wenn count>0, ein Null-Zeichen (CharT() wird im nächsten aufeinanderfolgenden Speicherort der Array gespeichert .Original:
If no characters were extracted, calls
setstate(failbit). In any case, if count>0, a null character (CharT() is stored in the next successive location of the array.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.
5)
Gleiche wie
get(strbuf, widen('\n')), dass heißt, wird Zeichenanzahl und fügt sie zu dem gegebenen Objekt, bis basic_streambuf '\n' gefunden wird ..Original:
same as
get(strbuf, widen('\n')), that is, reads available characters and inserts them to the given basic_streambuf object until '\n' is found.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.
6)
liest Zeichen und fügt sie an den Ausgang Sequenz durch die gegebenen basic_streambuf Objekt gesteuert Zeichen werden extrahiert und in
strbuf eingeführt, bis eine der folgenden Situationen eintritt:.Original:
reads characters and inserts them to the output sequence controlled by the given basic_streambuf object. Characters are extracted and inserted into
strbuf until any of the following occurs: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.
- Ende der Datei auftritt in der EingabesequenzOriginal:end of file condition occurs in the input sequenceThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- einzufügen in die... Ausgangssequenz fehlschlägt (in welchem Fall das Zeichen, das nicht eingesetzt werden konnten, nicht extrahiert)Original:insert into the output sequence fails (in which case the character that could not be inserted, is not extracted)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- der nächste verfügbare Eingabezeichen entspricht
cdelim, wie durchTraits::eq(c, delim)bestimmt. Dieses Zeichen nicht extrahiert .Original:the next available input charactercequalsdelim, as determined byTraits::eq(c, delim). This character is not extracted.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- eine Ausnahme auftritt (in diesem Fall wird die Ausnahme abgefangen und nicht weitergeleitet)Original:an exception occurs (in which case the exception is caught and not rethrown)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Wenn keine Zeichen extrahiert wurden, Anrufe
setstate(failbit) . Original:
If no characters were extracted, calls
setstate(failbit). 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.
Alle Versionen den Wert
gcount() der Anzahl von Zeichen extrahiert .Original:
All versions set the value of
gcount() to the number of characters extracted.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.
Parameter
| ch | - | Verweisen auf das Zeichen, um das Ergebnis zu schreiben
Original: reference to the character to write the result to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| s | - | Zeiger auf die Zeichenkette, um die Zeichen zu speichern
Original: pointer to the character string to store the characters to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| count | - | Größe der Zeichenfolge, auf die
sOriginal: size of character string pointed to by sThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| delim | - | Trennzeichen, um die Extraktion bei stoppen. Es ist nicht extrahiert und nicht gespeichert .
Original: delimiting character to stop the extraction at. It is not extracted and not stored. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| strbuf | - | Strompuffer, um den Inhalt zu lesen
Original: stream buffer to read the content to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Rückgabewert
1)
das extrahierte Zeichen oder
Traits::eof()Original:
the extracted character or
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.
2-6) *this
Beispiel
#include <sstream>
#include <iostream>
int main()
{
std::istringstream s1("Hello, world.");
char c1 = s1.get(); // reads 'H'
std::cout << "after reading " << c1 << ", gcount() == " << s1.gcount() << '\n';
char c2;
s1.get(c2); // reads 'e'
char str[5];
s1.get(str, 5); // reads "llo,"
std::cout << "after reading " << str << ", gcount() == " << s1.gcount() << '\n';
std::cout << c1 << c2 << str;
s1.get(*std::cout.rdbuf()); // reads the rest, not including '\n'
std::cout << "\nAfter the last get(), gcount() == " << s1.gcount() << '\n';
}
Output:
after reading H, gcount() == 1
after reading llo,, gcount() == 4
Hello, world.
After the last get(), gcount() == 7
Siehe auch
extrahiert Blöcken von Zeichen Original: extracts blocks of characters The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
Extrakte formatierte Daten Original: extracts formatted data The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |
extrahiert Zeichen und Zeichen-Arrays Original: extracts characters and character arrays The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktions-Template) | |