我用CFile file;
CString str = "\n";
file.Write(str,str.GetLength());
好象不行哦?还有CFile里面能不能直接读出一行的字符串,赋予一个CString变量?
请大虾指教!!!

解决方案 »

  1.   

    CStdioFile hfile ;
    hfile.ReadString(...)
      

  2.   

    大虾,
    那怎么控制一行一行地读,直到结尾呢?我用下列语句结果造成了死循环:CString strPathName;
    CString str = "\r\n";
    int nLength = str.GetLength(); while(dwBytesRemaining > 0)
    {
    DWORD dwPosition = file.GetPosition();
    file.Seek(dwPosition,CFile::begin);
    file.ReadString(strPathName);
    dwBytesRemaining -= (strPathName.GetLength() + str.GetLength());
            m_wndListBox.AddString(strPathName);
    }
      

  3.   

    我把dwBytesRemaining的类型由DWORD改到int类型后就正常工作了
    难道DWORD类型是无符号类型吗?
      

  4.   

    微软这样定义的:typedef unsigned long DWORD;你说有没有符号