#include <iostream>
using namespace std;
int main()
{
//Linux下的资料查得特别蛋疼。这个程序自己都没有运行。
fstream file("a.txt");
cout << file.tellg() << endl;
cout << file.tellp() << endl;
char ch;
file.get(ch);
cout << file.tellg() << endl;
cout << file.tellp() << endl;
file.seekg(3);
file.get(ch);
cout << ch << endl;
file.seekp(1);
file.get(ch);
cout << ch << endl;
ch = file.peek();
cout << ch << endl;
file.get(ch);
cout << ch << endl;
file.close();
}
fstream成员函数tellg,tellp,seekg,get,seekp,peek
最新推荐文章于 2024-04-29 16:25:27 发布