Espacios de nombres
Variantes
Acciones

std::basic_istream::getline

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

 
 
Entrada / salida de la biblioteca
I / O manipuladores
C-estilo I / O
Buffers
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(obsoleto)
Arroyos
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstracciones
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
Cadena de 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
Matriz 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(obsoleto)
ostrstream(obsoleto)
strstream(obsoleto)
Tipos
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
Error interfaz categoría
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
Los objetos globales
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
Las funciones miembro
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)
Entrada con formato
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>>
Entrada sin formato
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
Posicionamiento
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
Varios
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)
Clases de miembros
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
Terceros funciones
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)
Extrae caracteres del arroyo hasta el final de la línea (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)
Extrae caracteres del arroyo hasta el delimitador especificado .
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.
Se comporta como UnformattedInputFunction. Después de la construcción y comprobación del objeto centinela, extrae los caracteres de *this y los guardó en lugares sucesivos de la serie cuyo primer elemento es apuntado por s hasta que cualquiera de las siguientes situaciones: (a prueba en el orden indicado)
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.
  • condición de fin de archivo se produce en la secuencia de entrada (en el que setstate(eofbit) caso se ejecuta)
    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.
  • c el siguiente carácter disponible es el delimitador, tal como se determina por Traits::eq(c, delim). El delimitador se extrae (a diferencia de basic_istream::get()) y se contaron hacia gcount(), pero no se almacena .
    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.
  • count-1 caracteres se han extraído (en el que se ejecuta setstate(failbit) caso) .
    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.
Si la función extrae ningún carácter (por ejemplo, si count < 1), setstate(failbit) se ejecuta .
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.
En cualquier caso, si count>0, entonces se almacena una CharT() carácter nulo en la siguiente localización sucesiva de la matriz y actualizaciones 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.

Contenido

[editar] Notas

Debido a la condición # 2 se prueba antes de la condición # 3, la línea de entrada que se ajusta exactamente a la memoria intermedia, no desencadena 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.
Debido a que el carácter de terminación se cuenta como personaje extraído, línea de entrada vacía no desencadena 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.

[editar] Parámetros

s -
puntero a la cadena de caracteres para almacenar los caracteres a
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 -
tamaño de la cadena de caracteres apuntada por 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 carácter para detener la extracción a. Se extrae pero no se almacenan .
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.

[editar] Valor de retorno

*this

[editar] Ejemplo

#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

[editar] Ver también

leer datos de una secuencia de E / S en una cadena
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.

(función)
extractos de formato de datos
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.

(miembro público función) [edit]
extractos personajes
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.

(miembro público función) [edit]
extrae los bloques de caracteres
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.

(miembro público función) [edit]