文件的读写

fstream fin;

string out;

fin.open("abc.txt");

fin>>out;

cout<<out;

//////////////////////////////

这样写的话,只能读到第一个空格符之前//为什么不是最后一个字符串而是第一个呢、?

换成:

while(fin>>out)

{

      cout<<out<<endl;

}

/////////////////////////////

才能完全显示txt的内容。

posted on 2012-02-17 17:12  chateldon  阅读(527)  评论(0编辑  收藏  举报

导航