在VC6.0中如何读取二进制文件,请高手们帮帮忙(初学者,请讲详细些)

解决方案 »

  1.   

    CStdioFile file;
    if( !file.Open( files, CFile::modeReadWrite | CFile::typeBinary) )
    {
    AfxMessageBox("打开文件出错!");
    return;
    }
    file.ReadString(m_Number); //读取一行
    // m_Edt_Number.SetWindowText(strEnter);
    file.Close();
      

  2.   

    CFile f;
    char buf[1024*20] = {0};
    try{
    f.Open("c:\\jcy.txt",CFile::modeRead|CFile::typeBinary);
    f.Read(buf,f.GetLength());
    TRACE(buf);
    f.Close();
    }
    catch(...)
    {}
      

  3.   

    以二进制格式打开文件好了  typeBinary
      

  4.   

    CFile f;
    char buf[1024*20] = {0};
    try{
    f.Open("c:\\jcy.txt",CFile::modeRead|CFile::typeBinary);
    f.Read(buf,f.GetLength());
    TRACE(buf);
    f.Close();
    }
    catch(...)
    {}