读未知大小文件

#include   <iostream> 
#include   <fstream> 
using   namespace   std; 

ifstream   ifile( "test.dat ",   ios::binary); 
ifile.seekg(0,   ios::end); 
int   filelen   =   ifile.tellg(); 
char   *pbuf   =   new   char[filelen]; 
ifile.seekg(0,   ios::beg); 
ifile.read(pbuf,   filelen); 
ifile.close(); 

你可能感兴趣的:(读未知大小文件)