c++读取txt文件

string fname =  "a.txt";
string buf;
fstream fp(fname );
while (!fp1.eof() && fp1.peek() != EOF){
    getline(fp1, buf);// read one line
}
fp.close();

 

posted @ 2019-07-28 20:23  BlueOceans  阅读(880)  评论(0编辑  收藏  举报