#include<iostream>
#include<fstream>
usingnamespace std;
int main()
{
fstream file;
file.open("c:\\test.txt",ios_base::out);
if (!file)
cerr<<"Error"<<endl;
else
{
file<<"Hello"<<endl;
file.close();
cout<<"End"<<endl;
}
file.open("c:\\test.txt",ios_base::app);
if (!file)
cerr<<"Error"<<endl;
else
{
for (int i=0;i<10;i++)
file<<i;
cout<<"End"<<endl;
}
}
After sucessfully completed the first part(Hello), it shows Error(designed in Line 23) when coming to the second part. It cannot perform the write-in of 0123456789. What is the problem? Thank you.