Namespace
Varianti

std::basic_istream::operator>>

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

 
 
Ingresso / libreria di output
I / O manipolatori
C-style I / O
Buffer
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(deprecato)
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.
Astrazioni
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
File 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(deprecato)
ostrstream(deprecato)
strstream(deprecato)
Tipi
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
Errore categoria interfaccia
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
Gli oggetti globali
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
Membri funzioni
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)
Ingresso formattato
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>>
Ingresso non formattato
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
Posizionamento
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
Varie
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)
Membri classi
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 membri funzioni
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)
 
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) (dal 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)
Estratti un valore intero chiamando 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.
5)
Estrae un valore in virgola mobile chiamando 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.
6)
Estratti bool valore chiamando 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.
7)
Estrae un valore generico puntatore chiamando 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.
8)
Chiede func(*this);, dove func è un manipolatore di I / O.
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.
9)
Si comporta come un UnformattedInputFunction. Dopo la costruzione e la verifica dell'oggetto sentinella, estrae tutti i dati dal flusso di input e lo memorizza per sb. L'estrazione si interrompe se una delle seguenti condizioni:
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.
  • end-of-file avviene sulla sequenza di input;
    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.
  • inserire nella sequenza di uscita fallisce (nel qual caso il carattere da inserire non viene estratto)
    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.
  • si verifica un'eccezione (in questo caso l'eccezione e 'colto).
    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 entrambi i casi, memorizza il numero di caratteri estratti nella variabile membro accede da chiamate successive a gcount()
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.

Indice

[modifica] Note

I (1-7) versioni del gestore si comportano come funzioni di ingresso in formato. Cioè, costruire un oggetto sentry all'inizio che svuota il legame () 'd buffer, se necessario, i controlli per gli errori, e gli estratti ed elimina tutti i caratteri di spazi bianchi a meno che il ios_base :: bandiera skipws è stato cancellato. L'ingresso è utilizzato solo se l'oggetto sentry restituisce true.
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.
La versione 8) non costruire l'oggetto sentinella. La versione 9) costruisce un oggetto sentinella con noskipws impostato true.
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.
Se l'estrazione non riesce (ad esempio, se una lettera è stata inserita una cifra in cui è previsto), value viene lasciato invariato e failbit è impostato (C fino + 11)
Original:
If extraction fails (e.g. if a letter was entered where a digit is expected), value is left unmodified and failbit is set (C fino + 11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se l'estrazione non riesce, lo zero viene scritto value e failbit è impostato. Se i risultati di estrazione di valore troppo grande o troppo piccolo per stare in value, std::numeric_limits<T>::max() o std::numeric_limits<T>::min() è scritto e bandiera failbit è impostato. (dal 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. (dal C++11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Parametri

value -
riferimento a un valore intero o in virgola mobile per memorizzare il valore estratto
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 -
puntatore a I / O. funzione manipolatore
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 -
puntatore alla streambuffer per scrivere tutti i dati
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.

[modifica] Valore di ritorno

*this

[modifica] Esempio

#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

[modifica] Vedi anche

estrae i caratteri e array di caratteri
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.

(funzione di modello) [edit]
esegue lo streaming di I / O di stringhe
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.

(funzione di modello)
esegue flusso di input e output di bitset
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.

(funzione)
serializza e deserializza un numero complesso
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.

(funzione di modello)
esegue flusso di ingresso e di uscita sul pseudo-casuale numero di motore
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.

(funzione) [edit]
esegue flusso di ingresso e di uscita sul pseudo-casuale distribuzione numerica
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.

(funzione) [edit]
estrae blocchi di caratteri
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.

(membro pubblico funzione) [edit]
estrae blocchi già disponibili di caratteri
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.

(membro pubblico funzione) [edit]
estratti di caratteri
Original:
extracts characters
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(membro pubblico funzione) [edit]
caratteri estratti fino a quando il carattere dato è stato trovato
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.

(membro pubblico funzione) [edit]