Namensräume
Varianten
Aktionen

std::basic_istream::get

Aus cppreference.com
< cpp‎ | io‎ | basic istream

 
 
Input / Output-Bibliothek
I / O-Manipulatoren
C-style I / O
Puffern
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(veraltet)
Streams
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstraktionen
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
Datei-I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
String I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Array I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(veraltet)
ostrstream(veraltet)
strstream(veraltet)
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Fehler Kategorie Schnittstelle
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_istream
Globale Objekte
Original:
Global objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cin
wcin
Member-Funktionen
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::basic_istream
basic_istream::~basic_istream
basic_istream::operator=(C++11)
Formatierte Eingabe
Original:
Formatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::operator>>
Unformatierte Eingabe
Original:
Unformatted input
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::get
basic_istream::peek
basic_istream::unget
basic_istream::putback
basic_istream::getline
basic_istream::ignore
basic_istream::read
basic_istream::readsome
basic_istream::gcount
Positionierung
Original:
Positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::tellg
basic_istream::seekg
Verschiedenes
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::sync
basic_istream::swap(C++11)
Mitglied Klassen
Original:
Member classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istream::sentry
Non-Member-Funktionen
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
operator>>(std::basic_istream)
 
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.
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.
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.
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.
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.
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.
  • n-1 Zeichen gespeichert wurden
    Original:
    n-1 characters have been stored
    The 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 c gleich delim, wie Traits::eq(c, delim) bestimmt. Dieses Zeichen wird nicht extrahiert (im Gegensatz basic_istream::getline())
    Original:
    the next available input character c equals delim, as determined by Traits::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.
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.
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.
  • Ende der Datei auftritt in der Eingabesequenz
    Original:
    end of file condition occurs in the input sequence
    The 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 c delim, wie durch Traits::eq(c, delim) bestimmt. Dieses Zeichen nicht extrahiert .
    Original:
    the next available input character c equals delim, as determined by Traits::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.
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.

Inhaltsverzeichnis

[Bearbeiten] 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 s
Original:
size of character string pointed to by s
The 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.

[Bearbeiten] 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.

2-6) *this

[Bearbeiten] 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

[Bearbeiten] 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) [edit]
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) [edit]
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) [edit]