basic_istream::tellg
Specifica la posizione corrente per il flusso.
pos_type tellg( );
Valore restituito
Posizione corrente all'interno del flusso.
Note
Se superato è false, la funzione membro restituisce rdbuf - > pubseekoff(0, cur, in).In caso contrario, restituisce pos_type(- 1).
Esempio
// basic_istream_tellg.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>
int main()
{
using namespace std;
ifstream file;
char c;
streamoff i;
file.open("basic_istream_tellg.txt");
i = file.tellg();
file >> c;
cout << c << " " << i << endl;
i = file.tellg();
file >> c;
cout << c << " " << i << endl;
}
Input: basic_istream_tellg.txt
0123456789
Output di programma
0 0
1 1
Requisiti
intestazione: <istream>
Spazio dei nomi: deviazione standard