首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

用CFile类,怎么判断文件末尾

2012-03-04 
用CFile类,如何判断文件末尾我要一行一行的读取文件,如果用GetLength函数该怎么用?有没有更简单的办法?[解

用CFile类,如何判断文件末尾
我要一行一行的读取文件,如果用GetLength函数该怎么用?有没有更简单的办法?

[解决办法]
MSDN
--------------------------------------------------
virtual LPTSTR ReadString( LPTSTR lpsz, UINT nMax ); 
throw( CFileException ); 

A pointer to the buffer containing the text data. NULL if end-of-file was reached without reading any data;
这个版本, 如果返回NULL, 就到文件尾了
--------------------------------------------------

BOOL ReadString(CString& rString); 
throw( CFileException ); 

 or if boolean, FALSE if end-of-file was reached without reading any data.
这个版本, 如果返回FALSE, 就到文件尾了

热点排行