如题

解决方案 »

  1.   

    CFile::Open 
    CFile::Read
    CString::GetBuffer
    CString::ReleaseBuffer
      

  2.   

    二进制数据放在CString里?
    干嘛用的?
      

  3.   

    CFile::typeBinary   ?
      

  4.   

    注意,放进去以后只能透过GetBuffer和ReleaseBuffer才能操作这个CString
    而是用+ = 等操作可能会变化其中的数据
      

  5.   

    建议是最好不要怎么干,如果没有什么非常的理由的话不如使用CHAR[]来存放,更利于处理
      

  6.   

    UP
    定义一个大的char[]数组。
      

  7.   


    同意  snaill(com.chinaos.snaill) ( ) 
    部分观点。但反对用 char[]建议使用 new char [文件长]来搞
      

  8.   

    CFile::typeBinary
    你可以用BYTE[]来存储,用CString不妥当。
      

  9.   

    CFile id_file;
    if (!id_file.Open("c:\\hpzp\\hpjldver.con",CFile::modeRead|CFile::typeBinary))
    {
    AfxMessageBox("打开文件失败!");
    return ;
    }
          BYTE buffer[4096];
          DWORD dwRead;      // Read in 4096-byte blocks,
          // remember how many bytes were actually read,
          // and try to write that many out. This loop ends
          // when there are no more bytes to read.      do
          {
             dwRead = id_file.Read(buffer, 4096);
          }
          while (dwRead > 0);      // Close both files      id_file.Close();