CStdioFile按行读取文件.

virtual LPTSTR ReadString(
   LPTSTR lpsz,
   UINT nMax 
);
virtual BOOL ReadString(
   CString& rString
);


CStdioFile aFile;
CFileException ex;
if (!aFile.Open("config.txt", CFile::modeRead, &ex))
{
    ex.ReportError();
    return;
}

char buf[BUFSIZ+1];
while (aFile.ReadString(buf, BUFSIZ))
{
    TRACE(buf);
}

aFile.Close();


CStdioFile aFile;
CFileException ex;
if (!aFile.Open("config.txt", CFile::modeRead, &ex))
{
    ex.ReportError();
    return;
}

CString strTmp;
while (aFile.ReadString(strTmp))
{
    TRACE(strTmp);
}

aFile.Close();




你可能感兴趣的:(CStdioFile按行读取文件.)