2012年5月4日
摘要: 当file.eof()=1的时候seekg就不好用了,当file.eof()=0的时候seekg是好用的。也就是说当一个文件读到尾部以后,不能再用seekg来移动或者定位了。通过建立该文件新的对象能解决这个问题。如果只是输出的话可以用streambuf的rdbuf#include<fstream>#include<iostream>#include<string>using namespace std;int main(){ ofstream ofile("test.txt"); ofile<<"hello this 阅读全文
posted @ 2012-05-04 00:35 渊蓝之蓝 阅读(1345) 评论(1) 推荐(0) 编辑