Namespace
Varianti

std::basic_istream::getline

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& getline( char_type* s, std::streamsize count );
(1)
basic_istream& getline( char_type* s, std::streamsize count, char_type delim );
(2)
1)
Caratteri estratti flusso fino alla fine della linea (equivalente a getline(s, count, widen(’\n’)))
Original:
Extracts characters from stream until the end of line (equivalent to getline(s, count, widen(’\n’)))
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Estratti i caratteri dal flusso fino a quando il delimitatore specificato.
Original:
Extracts characters from stream until the specified delimiter.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Si comporta come UnformattedInputFunction. Dopo la costruzione e la verifica dell'oggetto sentinella, estrae i caratteri da *this e memorizzati in posizioni successive della matrice il cui primo elemento è puntato da s fino a qualsiasi dei seguenti casi: (testato nell'ordine indicato)
Original:
Behaves as UnformattedInputFunction. After constructing and checking the sentry object, extracts characters from *this and stored them in successive locations of the array whose first element is pointed to by s until any of the following occurs: (tested in the order shown)
The 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 (nel qual caso setstate(eofbit) viene eseguita)
    Original:
    end of file condition occurs in the input sequence (in which case setstate(eofbit) is executed)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • il c successivo carattere disponibile è il delimitatore, come determinato da Traits::eq(c, delim). Il delimitatore viene estratto (a differenza basic_istream::get()) e conteggiati gcount(), ma non viene memorizzato.
    Original:
    the next available character c is the delimiter, as determined by Traits::eq(c, delim). The delimiter is extracted (unlike basic_istream::get()) and counted towards gcount(), but is not stored.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Caratteri count-1 sono stati estratti (nel qual caso viene eseguita setstate(failbit)).
    Original:
    count-1 characters have been extracted (in which case setstate(failbit) is executed).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Se la funzione estrae nessun carattere (ad esempio, se count < 1), setstate(failbit) viene eseguito.
Original:
If the function extracts no characters (e.g. if count < 1), setstate(failbit) is executed.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
In ogni caso, se count>0, si memorizza un carattere nullo CharT() nella successiva posizione successiva della matrice e aggiornamenti gcount().
Original:
In any case, if count>0, it then stores a null character CharT() into the next successive location of the array and updates 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

Poiché condizione # 2 è stato testato prima # 3, la linea di ingresso che si adatta esattamente il buffer, non attiva failbit.
Original:
Because condition #2 is tested before condition #3, the input line that exactly fits the buffer, does not trigger failbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Poiché il carattere di terminazione viene conteggiato come carattere estratto, ingresso di linea vuota non fa scattare failbit.
Original:
Because the terminating character is counted as extracted character, empty input line does not trigger failbit.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[modifica] Parametri

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. E 'estratto ma non memorizzato .
Original:
delimiting character to stop the extraction at. It is extracted but not stored.
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 <sstream>
#include <vector>
#include <array>
 
int main()
{
    std::istringstream input("abc|def|gh");
    std::vector<std::array<char, 4>> v;
 
    for(std::array<char, 4> a; input.getline(&a[0], 4, '|'); ) {
        v.push_back(a);
    }
 
    for(auto& a : v) {
        std::cout << &a[0] << '\n';
    }
}

Output:

abc
def
gh

[modifica] Vedi anche

leggere i dati da un I / O corrente in una stringa
Original:
read data from an I/O stream into a string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(funzione)
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.

(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]
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]