ReadString和WriteString

CStdioFile SFile;

CString csReadString;
CString csBrowseFileName = OpenDialog(); //打开文件对话框,选择打开的文件

if(csBrowseFileName == "")
return;
else
SFile.Open(csBrowseFileName, CFile::modeRead);
while(SFile.ReadString(csReadString)) //ReadString每次读取一行

{

for(int i = 0; i < 4; i++)
{
AfxExtractSubString(csExtractString, csReadString, i, ' ');
if(i != 0)
{
dExtractString = _ttol(csExtractString);
vLatLonHgt.push_back(dExtractString);
}
}

}




CStdioFile SFile;
CString csSaveFileName = SaveDialog(); 打开保存对话框,选择文件保存的路径


if(csSaveFileName == "")
return;

SFile.Open(csSaveFileName, CFile::modeCreate | CFile::modeWrite);

SFile.WriteString("hello");

你可能感兴趣的:(ReadString和WriteString)