C++读写文件

文章目录

C++读写文件原文链接:

C++读写

#include <fstream>

int main()
{
    fstream file("file.txt");
    string line;
    out<<"out"<<endl;//不可以同时读写
    for(int i=0;i<10;i++)
        getline(file,line);
    cout<<line<<endl;
    return 0;
}