请问VC++(MFC)中如何读取文本文件并赋值?

2024-12-15 21:31:08
推荐回答(2个)
回答1:

CStdioFile file;
file.open("a.txt");
CString str;
while(file.isEof){
file.readLine(str);
}

回答2:

CString data=_T("我会写TXT啦!");
CFile txttest("D:test.txt",CFile::modeCreate|CFile::modeWrite);
txttest.Write(data,data.GetLength());
txttest.Close();