Espaços nominais
Variantes
Acções

std::basic_istream::operator>>

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.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(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.
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
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.
basic_istringstream
basic_ostringstream
basic_stringstream
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.
istrstream(obsoleta)
ostrstream(obsoleta)
strstream(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.
streamoff
streamsize
fpos
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.
iostream_category(C++11)
io_errc(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.
cin
wcin
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.
operator>>(std::basic_istream)
 
basic_istream& operator>>( short& value );
basic_istream& operator>>( unsigned short& value );
(1)
basic_istream& operator>>( int& value );
basic_istream& operator>>( unsigned int& value );
(2)
basic_istream& operator>>( long& value );
basic_istream& operator>>( unsigned long& value );
(3)
basic_istream& operator>>( long long& value );
basic_istream& operator>>( unsigned long long& value );
(4) (a partir do C++ 11)
basic_istream& operator>>( float& value );

basic_istream& operator>>( double& value );

basic_istream& operator>>( long double& value );
(5)
basic_istream& operator>>( bool& value );
(6)
basic_istream& operator>>( void*& value );
(7)
basic_istream& operator>>( basic_istream& st,

                           std::ios_base& (*func)(std::ios_base&) );
basic_istream& operator>>( basic_istream& st,
                           std::basic_ios<CharT,Traits>& (*func)(std::basic_ios<CharT,Traits>&) );
basic_istream& operator>>( basic_istream& st,

                           std::basic_istream& (*func)(std::basic_istream&) );
(8)
basic_istream& operator>>( basic_istream& st,
                           std::basic_streambuf<CharT,Traits>* sb );
(9)
1-4)
Extratos um valor inteiro chamando num_get::get()
Original:
Extracts an integer value by calling num_get::get()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
5)
Extrai um valor de ponto flutuante chamando num_get::get()
Original:
Extracts a floating point value by calling num_get::get()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
Extratos bool valor chamando num_get::get()
Original:
Extracts bool value by calling num_get::get()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
7)
Extrai um valor de ponteiro genérico chamando num_get::get()
Original:
Extracts a generic pointer value by calling num_get::get()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
8)
func(*this); chamadas, onde func é um manipulador de E / S.
Original:
Calls func(*this);, where func is an I/O manipulator.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
9)
Se comporta como um UnformattedInputFunction. Depois de construir e verificar o objeto de sentinela, extrai todos os dados do fluxo de entrada e armazena-sb. A extração pára se uma das seguintes condições:
Original:
Behaves as an UnformattedInputFunction. After constructing and checking the sentry object, extracts all data from the input stream and stores it to sb. The extraction stops if one of the following conditions are met:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • fim-de-arquivo ocorre na seqüência de entrada,
    Original:
    end-of-file occurs on 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 na sequência de saída de falha (caso em que o carácter a ser inserido não é extraído),
    Original:
    inserting in the output sequence fails (in which case the character to 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.
  • ocorre uma exceção (caso em que a exceção é capturada).
    Original:
    an exception occurs (in which case the exception is caught).
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
Em qualquer caso, armazena o número de caracteres extraídos na variável de membro acessado por chamadas subseqüentes para gcount()
Original:
In either case, stores the number of characters extracted in the member variable accessed by subsequent calls to gcount()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Índice

[editar] Notas

As versões (1-7) do operador de comportar-se como funções de entrada formatados. Isto é, construir um objeto sentry no início que libera o empate () 'd buffers, se necessário, verifica os erros e extratos e descarta todos os caracteres espaço em branco, a menos que o ios_base :: bandeira skipws foi desmarcada. A entrada é tentada apenas se o objecto sentry retorna true.
Original:
The (1-7) versions of the operator behave as formatted input functions. That is, they construct a sentry object at the beginning that flushes the tie()'d buffers if needed, checks for errors, and extracts and discards all leading whitespace characters unless the ios_base::skipws flag was cleared. The input is attempted only if the sentry object returns true.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
A versão 8) não construir o objeto de sentinela. A versão 9) constrói um objeto de sentinela com noskipws definido para true.
Original:
The version 8) does not construct the sentry object. The version 9) constructs a sentry object with noskipws set to true.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se extração falha (por exemplo, se uma carta foi digitada onde um dígito é esperado), value permanecerá inalterado e failbit está definido (até C + 11)
Original:
If extraction fails (e.g. if a letter was entered where a digit is expected), value is left unmodified and failbit is set (até C + 11)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se extração falha, zero é escrito para value e failbit está definido. Se os resultados de extração de valor muito grande ou muito pequeno para caber em value, std::numeric_limits<T>::max() ou std::numeric_limits<T>::min() está escrito e bandeira failbit está definido. (a partir do C++ 11)
Original:
If extraction fails, zero is written to value and failbit is set. If extraction results in the value too large or too small to fit in value, std::numeric_limits<T>::max() or std::numeric_limits<T>::min() is written and failbit flag is set. (a partir do C++ 11)
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

value -
referência para um valor inteiro ou de ponto flutuante para armazenar o valor extraído
Original:
reference to an integer or floating-point value to store the extracted value to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
func -
ponteiro para função I / O manipulador
Original:
pointer to I/O manipulator function
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
sb -
ponteiro. ao streambuffer para escrever todos os dados
Original:
pointer to the streambuffer to write all the data 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

*this

[editar] Exemplo

#include <iostream>
#include <iomanip>
#include <sstream>
int main()
{
    std::string input = "41 3.14 false hello world";
    std::istringstream stream(input);
    int n;
    double f;
    bool b;
 
    stream >> n >> f >> std::boolalpha >> b;
    std::cout << "n = " << n << '\n'
              << "f = " << f << '\n'
              << "b = " << std::boolalpha << b << '\n';
 
    // extract the rest using the streambuf overload
    stream >> std::cout.rdbuf();
    std::cout << '\n';
}

Output:

n = 41
f = 3.14
b = false
hello world

[editar] Veja também

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]
realiza fluxo de I / O de strings
Original:
performs stream I/O of strings
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)
realiza fluxo de entrada e saída de bitsets
Original:
performs stream input and output of bitsets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função)
serializa e desserializa um número complexo
Original:
serializes and deserializes a complex number
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)
executa fluxo de entrada e saída em pseudo-aleatório motor número
Original:
performs stream input and output on pseudo-random number engine
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função) [edit]
executa fluxo de entrada e saída em pseudo-aleatório distribuição de números
Original:
performs stream input and output on pseudo-random number distribution
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função) [edit]
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]
extrai blocos já disponíveis de caracteres
Original:
extracts already available 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 personagens
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.

(função pública membro) [edit]
extratos de caracteres até o caráter dado foi encontrado
Original:
extracts characters until the given character is found
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]