文件的读取

文件读入读出当然是最简单的ofstream 和 ifstream,当想从文件的某个位置来读取呢?看下面代码 1.将b.txt中的数据一个一个读到a.txt char a='0'; ifstream fin("b.txt"); ofstream fout; ifstream::pos_type cur; while(fin>>a) { cur=fin.tellg(); fin.close(); fout.open("a.txt",ios::app); fout<<a; fout<<flush; fout.close(); fin.open("b.txt"); ...
默认分类 | 2009-03-11 23:31 | 阅读 1913 次 | 评论 0 条

文件的读取

文件读入读出当然是最简单的ofstream 和 ifstream,当想从文件的某个位置来读取呢?看下面代码 1.将b.txt中的数据一个一个读到a.txt char a='0'; ifstream fin("b.txt"); ofstream fout; ifstream::pos_type cur; while(fin>>a) { cur=fin.tellg(); fin.close(); fout.open("a.txt",ios::app); fout<<a; fout<<flush; fout.close(); fin.open("b.txt"); ...
C++ | 2009-03-11 23:30 | 阅读 1653 次 | 评论 0 条
文章分类
文章归档
最新评论