写文件:
#include<fstream>
CStdioFile file; file.Open(_T("parametertable.txt"), CFile::modeCreate|CFile::modeWrite); file.WriteString(cstr+_T(" "));//cstr---CString 类型 file.Close();
读文件:
CStdioFile file; int isOPend; isOPend = file.Open(_T("ParameterSetting.ini"),CFile::modeRead); if (!isOPend) {AfxMessageBox(_T("文件不存在或加载错误!")); return;} CString strLine; while(file.ReadString(strLine)) //每行读入strLine {......} file.Close();