Espaços nominais
Variantes
Acções

std::cin, std::wcin

Da cppreference.com
< cpp‎ | io

 
 
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.
cinwcin
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.
 
Definido no cabeçalho <iostream>
extern std::istream cin;
(1)
extern std::wistream wcin;
(2)
Os objectos globais std::cin e std::wcin entrada de controlo a partir de um fluxo de tampão de aplicação (tipo definido derivado de std::streambuf), associado com o padrão de fluxo de entrada C stdin.
Original:
The global objects std::cin and std::wcin control input from a stream buffer of implementation-defined type (derived from std::streambuf), associated with the standard C input stream stdin.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Esses objetos são garantidos para ser construído antes de o primeiro construtor de um objeto estático é chamado e eles são garantidos para sobreviver à última destruidor de um objeto estático, de modo que é sempre possível ler de std::cin no código do usuário.
Original:
These objects are guaranteed to be constructed before the first constructor of a static object is called and they are guaranteed to outlive the last destructor of a static object, so that it is always possible to read from std::cin in user code.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
A menos que sync_with_stdio(false) foi emitido, ele é seguro para acessar simultaneamente esses objetos de vários segmentos para entrada formatado e não formatado.
Original:
Unless sync_with_stdio(false) has been issued, it is safe to concurrently access these objects from multiple threads for both formatted and unformatted input.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Uma vez std::cin é construído, std::cin.tie() retornos &std::cout e, também, std::wcin.tie() retornos &std::wcout. Isso significa que qualquer operação de entrada formatada em std::cin força uma chamada para std::cout.flush() se quaisquer caracteres estão pendentes para a saída.
Original:
Once std::cin is constructed, std::cin.tie() returns &std::cout, and likewise, std::wcin.tie() returns &std::wcout. This means that any formatted input operation on std::cin forces a call to std::cout.flush() if any characters are pending for output.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar] Exemplo

#include <iostream>
struct Foo {
    int n;
    Foo() {
       std::cout << "Enter n: "; // no flush needed
       std::cin >> n;
    }
};
Foo f; // static object
int main()
{
    std::cout << "f.n is " << f.n << '\n';
}

Saída:

Enter n: 10
f.n is 10

[editar] Veja também

inicializa objetos de fluxo padrão
Original:
initializes standard stream objects
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::ios_base public class membro) [edit]
grava o padrão de fluxo de saída stdout
(objeto global) C
Original:
writes to the standard C output stream stdout
(objeto global)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[edit]