C++按行读/写txt文件
将”hello”写入F:/test.txt的第1行
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
fstream outfile;
outfile.open("F:/test.txt",ios::out);
if(!outfile)
{
cout<<"file can not open"<<endl;
abort();
}
for(int i=0;i<1;i++)
{
outfile<<