std::basic_istream::get
Da cppreference.com
< cpp | io | basic istream
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
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.
You can help to correct and verify the translation. Click here for instructions.
Todas as versões de se comportar como
1) UnformattedInputFunction
s. Depois de construir e verificar o objeto de sentinela, estas funções faça o seguinte: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.
lê um caractere e retorna-se disponível. Caso contrário, retorna Traits::eof() e conjuntos
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.
lê um caractere e armazena-
3) 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.
You can help to correct and verify the translation. Click here for instructions.
mesmo que get(s, count, widen('\n')), isto é, lê em caracteres maioria count-1 e os armazena em cadeia de caracteres apontada por
4) 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.
You can help to correct and verify the translation. Click here for instructions.
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.
You can help to correct and verify the translation. Click here for instructions.
- n-1 caracteres foram armazenadosOriginal: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.
- 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 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 nenhum dos caracteres foram extraídos, chama setstate(failbit). Em qualquer caso, se
5) 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.
You can help to correct and verify the translation. Click here for instructions.
get(strbuf, widen('\n')) mesma, isto é, lê os caracteres disponíveis e insere-as para o objecto basic_streambuf dada até '\n' é encontrada..
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.
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.
You can help to correct and verify the translation. Click here for instructions.
- condição de fim de arquivo ocorre na seqüência de entradaOriginal: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.
- 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
igualdelim
, conforme determinado pelo Traits::eq(c, delim). Este carácter não é extraído.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.
- 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.
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.
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.
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) | |
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) | |
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) |