Espaços nominais
Variantes
Acções

std::basic_istream::putback

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.
 
basic_istream& putback( char_type ch );
Coloca o personagem ch de volta para o fluxo de entrada de modo que o próximo personagem extraído será ch.
Original:
Puts the character ch back to the input stream so the next extracted character will be ch.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Primeiro limpa eofbit, em seguida, se comporta como UnformattedInputFunction. Depois de construir e verificar o objeto de sentinela, se rdbuf() não é nulo, chama rdbuf()->sputbackc(ch), que chama rdbuf()->pbackfail(ch) se ch não é igual o personagem mais recentemente extraído.
Original:
First clears eofbit, then behaves as UnformattedInputFunction. After constructing and checking the sentry object, if rdbuf() is not null, calls rdbuf()->sputbackc(ch), which calls rdbuf()->pbackfail(ch) if ch does not equal the most recently extracted character.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Se rdbuf() é nulo ou se rdbuf->sputbackc(ch) retornos Traits::eof(), chama setstate(badbit).
Original:
If rdbuf() is null or if rdbuf->sputbackc(ch) returns Traits::eof(), calls setstate(badbit).
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, define o gcount() contador a zero.
Original:
In any case, sets the gcount() counter to zero.
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

(Nenhum)
Original:
(none)
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

demonstra a diferença entre a modificação e não modificar putback ()
Original:
demonstrates the difference between modifying and non-modifying putback()
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

#include <sstream>#include <iostream>int main(){std::stringstream s1("Hello, world");// IO stream s1.get();if(s1.putback('Y'))// modifies the bufferstd::cout<< s1.rdbuf()<<'\n';elsestd::cout<<"putback failed\n";   std::istringstream s2("Hello, world");// input-only stream s2.get();if(s2.putback('Y'))// cannot modify input-only bufferstd::cout<< s2.rdbuf()<<'\n';elsestd::cout<<"putback failed\n";   s2.clear();if(s2.putback('H'))// non-modifying putbackstd::cout<< s2.rdbuf()<<'\n';elsestd::cout<<"putback failed\n";}

Saída:

Yello, world putback failed Hello, world

[editar]Veja também

unextracts um personagem
Original:
unextracts a character
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]
lê o próximo caractere sem extraí-lo
Original:
reads the next character without extracting it
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]
close