basic_istream::tellg
Reports the current read position in the stream.
pos_type tellg( );
반환 값
스트림 내의 현재 위치입니다.
설명
If fail is false, the member function returns rdbuf -> pubseekoff(0, cur, in). Otherwise, it returns pos_type(-1).
예제
// 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
프로그램 출력
0 0
1 1
요구 사항
Header: <istream>
네임스페이스: std