Sdílet prostřednictvím


basic_istream::tellg

Zprávy číst aktuální pozici v datovém proudu.

pos_type tellg( );

Vrácená hodnota

Aktuální pozice v datovém proudu.

Poznámky

Pokud selhání je false, vrátí členské funkce rdbuf ->pubseekoff(0, cur, v).Funkce pos_type(-1).

Příklad

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

Vstup: basic_istream_tellg.txt

0123456789

Výstup programu

0 0
1 1

Požadavky

Záhlaví:<istream>

Obor názvů: std

Viz také

Referenční dokumentace

basic_istream – třída

iostream – programování

iostreams – konvence