C++读取txt文件

#include <fstream>
#include <iostream>
#include <stdlib.h>
using namespace std;
void   main()
{
 FILE   *pt;
 if((pt=fopen( "d:\\test.txt ",   "a+ "))==NULL)
 {
  cout << "erro " <<endl;
 }
 char   ch;
 while((ch=fgetc(pt))!=EOF)
 {
  cout <<ch;
 }
 fclose(pt);
 getchar();

}

posted @ 2011-11-05 12:56  byfei  阅读(273)  评论(0编辑  收藏  举报