std::basic_istream::operator>>
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> basic_istream& operator>>( short& value ); basic_istream& operator>>( unsigned short& value ); |
(1) | |
basic_istream& operator>>( int& value ); basic_istream& operator>>( unsigned int& value ); |
(2) | |
basic_istream& operator>>( long& value ); basic_istream& operator>>( unsigned long& value ); |
(3) | |
basic_istream& operator>>( long long& value ); basic_istream& operator>>( unsigned long long& value ); |
(4) | (seit C++11) |
basic_istream& operator>>( float& value ); basic_istream& operator>>( double& value ); basic_istream& operator>>( long double& value ); |
(5) | |
basic_istream& operator>>( bool& value ); |
(6) | |
basic_istream& operator>>( void*& value ); |
(7) | |
basic_istream& operator>>( basic_istream& st, std::ios_base& (*func)(std::ios_base&) ); basic_istream& operator>>( basic_istream& st, std::basic_ios<CharT,Traits>& (*func)(std::basic_ios<CharT,Traits>&) ); basic_istream& operator>>( basic_istream& st, std::basic_istream& (*func)(std::basic_istream&) ); |
(8) | |
basic_istream& operator>>( basic_istream& st, std::basic_streambuf<CharT,Traits>* sb ); |
(9) | |
1-4)
Auszüge einen Integer-Wert durch den Aufruf num_get::get()
Original:
Extracts an integer value by calling num_get::get()
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)
Extrahiert einen Gleitkommawert indem num_get::get()
Original:
Extracts a floating point value by calling num_get::get()
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)
Auszüge
bool Wert durch Aufrufen num_get::get()Original:
Extracts
bool value by calling num_get::get()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.
7)
Extrahiert einen generischen Zeiger-Wert durch den Aufruf num_get::get()
Original:
Extracts a generic pointer value by calling num_get::get()
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.
8)
Anrufe
func(*this);, wo func eine I / O-Manipulator ist .Original:
Calls
func(*this);, where func is an I/O manipulator.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.
9)
Verhält sich wie ein
UnformattedInputFunction. Nach dem Bau und Prüfung der Schildwache Objekt, extrahiert alle Daten aus dem Eingabe-Stream und speichert sie in sb. Die Extraktion wird beendet, wenn eine der folgenden Bedingungen erfüllt sind:Original:
Behaves as an
UnformattedInputFunction. After constructing and checking the sentry object, extracts all data from the input stream and stores it to sb. The extraction stops if one of the following conditions are met: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.
- End-of-file tritt auf der Eingangssequenz;Original:end-of-file occurs on 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. - Einfügen in der Ausgangssequenz fehlschlägt (in welchem Fall das Zeichen eingefügt wird nicht extrahiert);Original:inserting in the output sequence fails (in which case the character to 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. - eine Ausnahme auftritt (in welchem Fall das Ausnahme abgefangen wird) .Original:an exception occurs (in which case the exception is caught).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
In beiden Fällen speichert die Anzahl von Zeichen in der Membervariable durch anschließende Anrufe an
gcount() zugegriffen extrahiert Original:
In either case, stores the number of characters extracted in the member variable accessed by subsequent calls to
gcount() 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.
Notes
Die (1-7)-Versionen des Betreibers verhalten, als formatierte Eingabe-Funktionen. Das heißt, konstruieren sie eine
sentry Objekt am Anfang, dass spült die tie () 'd-Puffer, wenn nötig, Schecks für Fehler, und Extrakte und verwirft alle führenden Leerzeichen, sofern der ios_base :: skipws Flag gelöscht wurde. Der Eingang wird versucht nur, wenn die sentry Objekt true zurück .Original:
The (1-7) versions of the operator behave as formatted input functions. That is, they construct a
sentry object at the beginning that flushes the tie()'d buffers if needed, checks for errors, and extracts and discards all leading whitespace characters unless the ios_base::skipws flag was cleared. The input is attempted only if the sentry object returns true.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 Version 8) konstruiert nicht die Wache Objekt. Die Version 9) baut eine Wache Objekt mit
noskipws um true gesetzt .Original:
The version 8) does not construct the sentry object. The version 9) constructs a sentry object with
noskipws set to true.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.
Wenn die Extraktion fehl (zB wenn ein Brief eingegeben wurde, wo eine Ziffer erwartet wird), wird
value links unverändert und failbit wird (bis C + +11) gesetztOriginal:
If extraction fails (e.g. if a letter was entered where a digit is expected),
value is left unmodified and failbit is set (bis C + +11)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.
Wenn Extraktion fehlschlägt, wird Null auf
value und failbit wird geschrieben. Wenn Extraktion ergibt sich der Wert zu groß oder zu klein, um in value passen, std::numeric_limits<T>::max() oder std::numeric_limits<T>::min() geschrieben und failbit Flag gesetzt ist. (seit C++11)Original:
If extraction fails, zero is written to
value and failbit is set. If extraction results in the value too large or too small to fit in value, std::numeric_limits<T>::max() or std::numeric_limits<T>::min() is written and failbit flag is set. (seit C++11)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
| value | - | Verweis auf ein Integer-oder Floating-Point-Wert, um die extrahierte Wert zu speichern
Original: reference to an integer or floating-point value to store the extracted value to The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| func | - | Zeiger auf I / O-Manipulator-Funktion
Original: pointer to I/O manipulator function The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| sb | - | Zeiger auf die streambuffer, um alle Daten zu schreiben
Original: pointer to the streambuffer to write all the data 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
*this
Beispiel
#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
std::string input = "41 3.14 false hello world";
std::istringstream stream(input);
int n;
double f;
bool b;
stream >> n >> f >> std::boolalpha >> b;
std::cout << "n = " << n << '\n'
<< "f = " << f << '\n'
<< "b = " << std::boolalpha << b << '\n';
// extract the rest using the streambuf overload
stream >> std::cout.rdbuf();
std::cout << '\n';
}
Output:
n = 41
f = 3.14
b = false
hello world
Siehe auch
} 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) | |
führt Stream I / O von Strings Original: performs stream I/O of strings The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktions-Template) | |
führt Stream Ein-und Ausgang BitSets Original: performs stream input and output of bitsets The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
serialisiert und deserialisiert eine komplexe Zahl Original: serializes and deserializes a complex number The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktions-Template) | |
führt Stream Ein-und Ausgang auf Pseudo-Zufallszahlen-Motor Original: performs stream input and output on pseudo-random number engine The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
Stream führt Eingabe und Ausgabe auf Pseudozufallszahl Verteilung Original: performs stream input and output on pseudo-random number distribution The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (Funktion) | |
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) | |
extrahiert bereits verfügbaren Blöcke von Zeichen Original: extracts already available 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) | |
| Extrahiere Zeichen (öffentliche Elementfunktion) | |
Extrakte Zeichen, bis die gegebene Zeichen gefunden wird Original: extracts characters until the given character is found The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) | |