std::basic_istream::seekg
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. |
basic_istream& seekg( pos_type pos ); |
||
basic_istream& seekg( off_type off, std::ios_base::seekdir dir); |
||
Define indicador de entrada de posição do objeto atual
streambuf
associado. Em caso de falha, chama setstate(std::ios_base::failbit).Original:
Sets input position indicator of the current associated
streambuf
object. In case of failure, calls setstate(std::ios_base::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.
Primeiro, limpa
1) eofbit
(desde C++11), em seguida, se comporta como UnformattedInputFunction
, exceto que gcount()
não é afetado. Depois de construir e verificar o objeto de sentinelaOriginal:
First, clears
eofbit
(desde C++11), then behaves as UnformattedInputFunction
, except that gcount()
is not affected. After constructing and checking the sentry object,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.
define o indicador de posição de entrada para
2) pos
valor absoluto (em relação ao início do ficheiro). Especificamente, é executada rdbuf()->pubseekpos(pos, std::ios_base::in).Original:
sets the input position indicator to absolute (relative to the beginning of the file) value
pos
. Specifically, executes rdbuf()->pubseekpos(pos, std::ios_base::in).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.
define o indicador de posição de entrada para
off
posição, em relação à posição, definida por dir
. Especificamente, é executada rdbuf()->pubseekoff(off, dir, std::ios_base::in). Original:
sets the input position indicator to position
off
, relative to position, defined by dir
. Specifically, executes rdbuf()->pubseekoff(off, dir, std::ios_base::in). 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
pos | - | posição absoluta para definir o indicador de posição de entrada para .
Original: absolute position to set the input position indicator to. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||
off | - | posição relativa para definir o indicador de posição de entrada para .
Original: relative position to set the input position indicator to. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. | ||||||||||||||||||||||||||||||||
dir | - | define a posição de base para aplicar a diferença relativa a. Ela pode ser uma das seguintes constantes:
Original: defines base position to apply the relative offset to. It can be one of the following constants:
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 <string> #include <sstream> int main() { std::string str = "Hello, world"; std::istringstream in(str); std::string word1, word2; in >> word1; in.seekg(0); // rewind in >> word2; std::cout << "word1 = " << word1 << '\n' << "word2 = " << word2 << '\n'; }
Saída:
word1 = Hello, word2 = Hello,
[editar] Veja também
retorna o indicador de posição de entrada Original: returns the input position indicator 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) | |
retorna o indicador de posição de saída Original: returns the output position indicator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (of std::basic_ostream função pública membro)
| |
define o indicador de posição de saída Original: sets the output position indicator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (of std::basic_ostream função pública membro)
|