std::basic_istream::seekg
Da cppreference.com.
< cpp | io | basic istream
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
basic_istream& seekg( pos_type pos ); |
||
basic_istream& seekg( off_type off, std::ios_base::seekdir dir); |
||
Imposta la posizione di immissione della corrente dell'oggetto
streambuf
associato. In caso di guasto, chiama 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.
Primo, cancella
1) eofbit
(dal C++11), quindi si comporta come UnformattedInputFunction
, tranne che gcount()
non è interessato. Dopo la costruzione e la verifica dell'oggetto sentinella,Original:
First, clears
eofbit
(dal 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.
imposta l'indicatore di posizione di ingresso
2) pos
valore assoluto (relativo all'inizio del file). In particolare, esegue 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.
imposta l'indicatore di posizione di ingresso
off
posizione, rispetto alla posizione, definita da dir
. In particolare, esegue 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.
Indice |
[modifica] Parametri
pos | - | posizione assoluta per impostare l'indicatore di posizione di ingresso .
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 | - | posizione relativa per impostare l'indicatore di posizione di ingresso .
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 | - | definisce la posizione di base per applicare l'offset rispetto. Essa può essere una delle seguenti costanti:
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. |
[modifica] Valore di ritorno
*this
[modifica] Esempio
#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'; }
Output:
word1 = Hello, word2 = Hello,
[modifica] Vedi anche
restituisce l'indicatore di posizione di ingresso 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. (metodo pubblico) | |
restituisce l'indicatore di posizione di uscita 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. (metodo pubblico) | |
imposta l'indicatore di posizione di uscita 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. (metodo pubblico) |