初学vc,望多赐教!

解决方案 »

  1.   

    建一个单文本EditView视图的应用程序。如下读取文件内容pFile = new CFile(路径,CFile::modeRead);BYTE * pBuffer = new BYTE[255];UNIT nBytesRead;
    CString strHex;//Simple while loop to read every 255 bytes from file.
    while (0 < (nBytesRead = pFile->Read(pBuffer, 255)))
    {
       for (int nIndex = 0; nIndex < nByteRead; nIndex++)
       {
          if (nIndex == 0)
              strHex.Format(_T("%2.2X"), pBuffer[nIndex]);
          else if (nIndex % 16 == 0)
              strHex.Format(_T("\r\n%2.2X"), pBuffer[nIndex]);
          else if (nIndex % 8 == 0 )
              strHex.Format(_T("-%2.2X"),pBuffer[nIndex]);
          else 
              strHex.Format(_T(" %2.2X"), pBuffer[nIndex]);      m_strFileContents += strHex;
          }
       }pFile -> Close();
    delete pFile;然后把使用SetWindowsText把m_strFileContents传给EditView就可以了
      

  2.   

    其实你用C下的函数就可以了,fopen(),不过具体的参数一定要用"b",具体的你再看看msdn里面很详细,只要查fopen就可以查到