MFC

mfc 读取文件内容

2019-08-23  本文已影响0人  云胡同学
void ReadFile(CString filePath)
{
    CStdioFile readFile;
    CString readLine;            // 读到的每一行
    BOOL flag = readFile.Open(filePath, CFile::modeRead);
    if (flag == FALSE)
    {
        MessageBox(_T("打开文件失败"));
        return;
    }
    else
    {
        while (readFile.ReadString(readLine)) 
         {
               TRACE("%s\n", readLine);
         }
    }
    return;
}
上一篇 下一篇

猜你喜欢

热点阅读