Espaços nominais
Variantes
Acções

std::basic_istream::get

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

 
 
De entrada / saída da biblioteca
I / O manipuladores
C estilo de 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.
(obsoleta)
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.
Abstrações
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
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.
Cordas 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.
Matriz de 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.
(obsoleta)
(obsoleta)
(obsoleta)
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.
Interface de categoria de erro
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.
(C++11)
 
std::basic_istream
Objetos globais
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.
Funções de membro
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 formatada
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 não formatado
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
Posicionamento
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
Diversos
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)
Aulas-Membros
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
Não-membros funções
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.
 
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)
Extrai personagem ou personagens de fluxo.
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.
Todas as versões de se comportar como UnformattedInputFunctions. Depois de construir e verificar o objeto de sentinela, estas funções faça o seguinte:
Original:
All versions behave as UnformattedInputFunctions. 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.
1)
lê um caractere e retorna-se disponível. Caso contrário, retorna Traits::eof() e conjuntos 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.
2)
lê um caractere e armazena-ch se disponível. Caso contrário, deixa ch modificado e define failbit e eofbit. Note que esta função não está sobrecarregado sobre os tipos signed char e unsigned char, ao contrário do formatado >> operador de caracteres de entrada.
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.
3)
mesmo que get(s, count, widen('\n')), isto é, lê em caracteres maioria count-1 e os armazena em cadeia de caracteres apontada por s até '\n' é encontrada.
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.
4)
lê caracteres e armazena-os nos locais sucessivas da matriz de caracteres cujo primeiro elemento é apontado por s. Caracteres são extraídos e armazenados até qualquer uma das seguintes situações:
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.
  • n-1 caracteres foram armazenados
    Original:
    n-1 characters have been stored
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • condição de fim de arquivo ocorre na seqüência de entrada (setstate(eofbit) é chamado)
    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.
  • o caracter de entrada disponível é igual c delim, conforme determinado pelo Traits::eq(c, delim). Este personagem não é extraído (ao contrário basic_istream::getline())
    Original:
    the next available input character c equals delim, 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 nenhum dos caracteres foram extraídos, chama setstate(failbit). Em qualquer caso, se count>0, um caractere nulo (CharT() é armazenado na localização seguinte sucessiva da matriz.
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.
5)
get(strbuf, widen('\n')) mesma, isto é, lê os caracteres disponíveis e insere-as para o objecto basic_streambuf dada até '\n' é encontrada..
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.
6)
lê caracteres e insere-as para a seqüência de saída controlada pelo objeto basic_streambuf dado Personagens são extraídos e inseridos strbuf até qualquer uma das seguintes situações:.
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.
  • condição de fim de arquivo ocorre na seqüência de entrada
    Original:
    end of file condition occurs in 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.
  • inserir no... sequência de saída falhar (caso em que o carácter que não podem ser inseridos, não é extraído)
    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.
  • o caracter de entrada disponível seguinte c igual delim, conforme determinado pelo Traits::eq(c, delim). Este carácter não é extraído.
    Original:
    the next available input character c equals delim, 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.
  • ocorre uma excepção (em caso, a excepção é pego e não relançada)
    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 nenhum dos caracteres foram extraídos, chamadas 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.
Todas as versões definir o valor de gcount() ao número de personagens extraídos.
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.

Índice

[editar] Parâmetros

ch -
referência ao personagem para escrever o resultado
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 -
ponteiro para a cadeia de caracteres para armazenar os personagens
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 -
tamanho da cadeia de caracteres apontada 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 personagem para parar a extracção em. Não é extraído e não armazenados .
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 de fluxo de ler o conteúdo
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.

[editar] Valor de retorno

1)
caráter extraído ou 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.

2-6) *this

[editar] Exemplo

#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';
}

Saída:

after reading H, gcount() == 1
after reading llo,, gcount() == 4
Hello, world.
After the last get(), gcount() == 7

[editar] Veja também

extrai blocos 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.

(função pública membro) [edit]
extratos dados formatados
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.

(função pública membro) [edit]
extrai os caracteres e matrizes de caracteres
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.

(modelo de função) [edit]