1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <fstream>
using  namespace  std;
 
int  main()
{
         ifstream fin( "d:\\data\\english_story.txt" );
     if (fin.good())
     {
         cout<< "打开文件成功,以下是文件内容" <<endl;
         char  ch;
         while  (!fin.eof()) //未到文件尾时循环
         {
             ch=fin.get();
             cout<<ch;
         }
     }
     else  cout<< "打开文件错误" <<endl;
     fin.close();
     return  0;
}
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐