Udostępnij za pośrednictwem


basic_istream::tellg

Raporty odczytać bieżące położenie w strumieniu.

pos_type tellg( );

Wartość zwracana

Bieżąca pozycja w strumieniu.

Uwagi

Jeśli się niepowodzeniem jest FAŁSZ, funkcja zwraca element członkowski funkcja rdbuf ->pubseekoff(0, cur, w).W przeciwnym wypadku zwraca pos_type(-1).

Przykład

// 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;
}

Dane wejściowe: basic_istream_tellg.txt

0123456789

Dane wyjściowe programu

0 0
1 1

Wymagania

Nagłówek:<istream>

Przestrzeń nazw: std

Zobacz też

Informacje

basic_istream — Klasa

iostream Programming

Konwencje iostream