c++流读取文件

 

filebuf* pbuf;
long PEsize;
char* PEBuffer;

 ifstream FileStream;
 FileStream.open(d_path, ios::binary);
 if (!FileStream.is_open())
 {
  return -1;
 }
 pbuf = FileStream.rdbuf();
 PEsize = pbuf->pubseekoff(0, ios::end, ios::in);
 pbuf->pubseekpos(0, ios::in);
 PEBuffer = new char[PEsize];
 pbuf->sgetn(PEBuffer, PEsize);
 FileStream.close();                            //读入文件,PeBuffer

posted @ 2020-10-14 19:28  雨果然在下  阅读(264)  评论(0)    收藏  举报