我学的是c,用c的方法就是打开另一个文件,输出到里面.
用系统调用的方法就是system(echo str > b.txt);
你试试
我在VC6下试了下,不会死循环的
ifstream file("file.txt",ios::in);
char * str=new char[sizeof(file)]; //动态创建字符串数组
for(;!file.eof();)
{
file.getline(str, sizeof(file) );
cout<
// system("Pause");
file.close();
return 0;