ifstream is(pFilename, ios::in|ios::binary);
  is.seekg(0, ios::end); // 移到檔尾
  long nFileSize= is.tellg(); // 看看長得檔案長度
  is.seekg(0, ios::beg); // 移到檔頭
  char* pBuf = new char[nFileSize]; // 配置記憶體
  is.read(pBuf, nFileSize); // 讀取資料
  is.close(); // 關檔
  // ... 要做的事
 
沒有留言:
張貼留言