现在有一文本文件dev.txt,假设有三行内容
line1 //第一行
line2 //第二行
line3 //第三行
实现代码:
CStdioFile file;
CString m_strTemp;
file.Open("dev.txt",CStdioFile::modeRead);
file.ReadString(m_strTemp);//读取第一行line1,并将内容存放在m_strTemp中
现在怎么让程序接着继续往下,分别读取第二行line2和第三行line3?
line1 //第一行
line2 //第二行
line3 //第三行
实现代码:
CStdioFile file;
CString m_strTemp;
file.Open("dev.txt",CStdioFile::modeRead);
file.ReadString(m_strTemp);//读取第一行line1,并将内容存放在m_strTemp中
现在怎么让程序接着继续往下,分别读取第二行line2和第三行line3?
{
}
LPTSTR lpsz,
UINT nMax
);
virtual BOOL ReadString(
CString& rString
);
Parameters
lpsz
Specifies a pointer to a user-supplied buffer that will receive a null-terminated text string.nMax
Specifies the maximum number of characters to read, not counting the terminating null character.rString
A reference to a CString object that will contain the string when the function returns.Return ValueA pointer to the buffer containing the text data. NULL if end-of-file was reached without reading any data; or if boolean, FALSE if end-of-file was reached without reading any data. // 注意最后一个句子
{
}