用CStdioFile类打开文件,然后用ReadString来读取就可以。
肯定能实现。

解决方案 »

  1.   

    CString csLine;
    try
    {
       CStdioFile file("c:\\autoexec.bat",CFile::modeRead);
       while(file.ReadString(csLine))
          AfxMessageBox(csLine);
    }
    catch(...)
    {
         AfxMessageBox("打开文件错");
    }
      

  2.   

    使用CStdioFile类,用ReadString函数来读取
      

  3.   

    参考一段代码:使用ifstream
    char* pszPath = NULL;
    ::GetMacroBasePath(&pszPath);
    ifstream file;
    file.open(pszPath,ios::nocreate|ios::in);
    if(pszPath) delete pszPath;
    if(!file.good()) return rtnValue; char buffer[256];
    file.getline(buffer,255);
    if(_stricmp(buffer,"VERSION = 1.0") != 0)
    return rtnValue; CString strTemp(_T(""));
    file.getline(buffer,255);
    while(_stricmp(buffer,"") != 0)
    {
    strTemp = CString(buffer);
                      
                      file.getline(buffer,255);
              }
      

  4.   

    CStdioFile f;
    CFileException e;
    char *FileName = "temp.txt";
    if( !f.Open( FileName, CFile::modeRead, &e ) )
    { return;}
    CString line;
    while (f.ReadString(line))
    {
    }
    f.Close();
      

  5.   

    用CStdioFile吧
    readtring  
    ;)
    111222说得很清楚
      

  6.   

    csdn大不如以前方便,好用了。我再也不来了。