那我第一次使用 fstream::seekg() 和 tellg() 函数,于是我就写了个测试程序: void RandomFileReader(){ using std::ifstream; string fn = "d:\testfile.txt"; ifstream ifs(fn.c_str()); string line; std::getline(ifs,line); while(!line.em
the header in ascii mode. The problem is, sometimes tellg () gives me a completely incorrect result and sometimes it is just fine. Here is an example:char input[200]; std::ifstream fin("blocks.pgm ", std::ios::in); std::ifstream:: pos_type position = fin.tellg(); ...