<metanoindex/>
<tbody> </tbody> template< class CharT, class Traits > basic_istream<CharT,Traits>& operator>>( basic_istream<CharT,Traits>& st, CharT& ch ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, signed char& ch ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, unsigned char& ch ); |
(1) | |
template< class CharT, class Traits> basic_istream<CharT,Traits>& operator>>( basic_istream<CharT,Traits>& st, CharT* s ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, signed char* s ); template< class Traits > basic_istream<char,Traits>& operator>>( basic_istream<char,Traits>& st, unsigned char* s ); |
(2) | |
template< class CharT, class Traits, class T > basic_istream<CharT,Traits>& operator>>( basic_istream<CharT,Traits>&& st, T& value ); |
(3) | (seit C++11) |
Führt Zeicheneingabe Operationen .
Original:
Performs character input operations.
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)
Extrahiert einen Charakter und speichert sie in
ch .Original:
Extracts a character and stores it to
ch.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)
Extrahiert aufeinanderfolgenden Zeichen und speichert sie an aufeinanderfolgenden Stellen einer Zeichengruppe, deren erstes Element ist, um durch
s hingewiesen. Die Extraktion wird beendet, wenn eine der folgenden Bedingungen erfüllt sind:Original:
Extracts successive characters and stores them at successive locations of a character array whose first element is pointed to by
s. 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.
- ein Whitespace-Zeichen (wie von der ctype<CharT> Facette bestimmt) gefunden wird. Das Leerzeichen ist nicht extrahiert .Original:a whitespace character (as determined by the ctype<CharT> facet) is found. The whitespace 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. this->width() - 1Zeichen extrahiert werdenOriginal:this->width() - 1characters are extractedThe 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 wird eine zusätzliche Nullzeichen Wert
CharT() am Ende der Ausgabe gespeichert .Original:
In either case, an additional null character value
CharT() is stored at the end of the output.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)
Ruft die entsprechende Eingabe-Operator, da eine rvalue Verweis auf ein Input-Stream-Objekt (entspricht
st >> value) .Original:
Calls the appropriate extraction operator, given an rvalue reference to an input stream object (equivalent to
st >> value).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-2)-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-2) 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.
Parameter
| st | - | Eingabestrom, um die Daten zu extrahieren
Original: input stream to extract the data from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
| ch | - | Verweis auf ein Schriftzeichen, um das extrahierte Zeichen zu speichern
Original: reference to a character to store the extracted character 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 eine Zeichenkette, um die extrahierten Zeichen zu speichern
Original: pointer to a character string to store the extracted characters 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
st
Beispiel
#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
std::string input = "n greetings";
std::istringstream stream(input);
char c;
const int MAX = 6;
char cstr[MAX];
stream >> c >> std::setw(MAX) >> cstr;
std::cout << "c = " << c << '\n'
<< "cstr = " << cstr << '\n';
double f;
std::istringstream("1.23") >> f; // rvalue stream extraction
std::cout << "f = " << f << '\n';
}
Output:
c = n
cstr = greet
f = 1.23
Siehe auch
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) | |