std::basic_istream::get
Da cppreference.com.
< cpp | io | basic istream
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
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) | |
Estrae carattere oi caratteri dal flusso di.
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.
Tutte le versioni si comportano come
1) UnformattedInputFunction
s. Dopo la costruzione e la verifica dell'oggetto sentinella, queste funzioni eseguire le seguenti operazioni:Original:
All versions behave as
UnformattedInputFunction
s. 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.
legge un carattere e lo restituisce, se disponibile. In caso contrario, restituisce Traits::eof() e set
2) failbit
e 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.
legge un carattere e lo memorizza per
3) ch
se disponibile. In caso contrario, lascia ch
non modificato e imposta failbit
e eofbit
. Si noti che questa funzione non sia in sovraccarico sui tipi signed char unsigned char e, a differenza del formattato >> operatore di inserimento dei caratteri.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.
stessa get(s, count, widen('\n')), cioè, legge a caratteri più count-1 e li memorizza nella stringa di caratteri puntato da
4) s
fino '\n' si trova.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.
legge caratteri e li memorizza nelle posizioni successive della matrice di caratteri il cui primo elemento è puntato da
s
. I caratteri vengono estratte e memorizzate fino a una delle seguenti condizioni: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 caratteri sono stati memorizzatiOriginal: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.
- condizione di fine file avviene nella sequenza di input (setstate(eofbit) si chiama)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.
- il successivo carattere di input disponibili
c
paridelim
, come determinato da Traits::eq(c, delim). Questo carattere non è estratto (a differenza basic_istream::getline())Original:the next available input characterc
equalsdelim
, 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.
Se non sono stati estratti i caratteri, le chiamate setstate(failbit). In ogni caso, se
5) count>0
, un carattere nullo (CharT() è memorizzato nella prima posizione successiva della matrice.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.
get(strbuf, widen('\n')) stessa, che è, legge i caratteri disponibili e li inserisce all'oggetto basic_streambuf dato fino '\n' si trova..
6) 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.
legge caratteri e li inserisce la sequenza di uscita controllata dall'oggetto basic_streambuf dato caratteri vengono estratti e inseriti in
strbuf
fino a quando una delle seguenti condizioni:.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.
- condizione di fine file avviene nella sequenza di inputOriginal: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.
- inserire nel... sequenza di emissione fallisce (nel qual caso il carattere che non può essere inserito, non viene estratto)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.
- il carattere successivo ingresso disponibile
c
ugualedelim
, come determinato da Traits::eq(c, delim). Questo carattere non è estratto.Original:the next available input characterc
equalsdelim
, 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.
- verifica un'eccezione (in qual caso l'eccezione viene catturato e non rilanciata)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.
Se non sono stati estratti i caratteri, le chiamate 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.
Tutte le versioni impostare il valore della
gcount()
al numero di caratteri estratti.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.
Indice |
[modifica] Parametri
ch | - | riferimento al carattere di scrivere il risultato
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 | - | puntatore alla stringa di caratteri per memorizzare i caratteri
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 | - | dimensione della stringa di caratteri a cui punta
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 | - | delimitando carattere per fermare l'estrazione a. Non è estratto e non memorizzati .
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 | - | buffer di flusso per leggere il contenuto
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. |
[modifica] Valore di ritorno
1)il carattere estratto o 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
[modifica] Esempio
#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
[modifica] Vedi anche
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. (metodo pubblico) | |
estratti i dati formattati 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. (metodo pubblico) | |
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) |