例如我想实现: while(!MyFile.eof())
MyFile.读一行(); 可是我发现CStdioFile和CFile都没有eof()函数.请问如何检测结尾?
MyFile.读一行(); 可是我发现CStdioFile和CFile都没有eof()函数.请问如何检测结尾?
解决方案 »
- DLL的多线程问题
- 提问关于派生CSTATIC类DC的操作,看这端代码是不是有什么错误
- 如何在CListCtrl的子项(SubItem)里添加按钮
- BitBlt 的奇怪问题,再送大家一个我整理的屏幕截屏的 C++ 类
- 请教这个程序HTTP Debugger的功能是如何实现的?实现一个类似的功能需要多复杂?
- 关于CSOCK重新连接的问题
- 请教高手一个输入法的问题
- 大家帮我看看下面的程序什么地方有问题,为什么socket连接就是不能成功?
- 动态创建(100分)
- 请问为何我做的弹出菜单运行时只显示一小竖条,用鼠标点击后再显示菜单?
- GetSubMenu内断言为什么会失败?
- 如何控制CWebBrowser控件,显示工具条,在一个View中显示?
2.当前pos是否结束
--------------------------------------------------------------------------------
The information in this article applies to:The Microsoft Foundation Classes (MFC), used with:
Microsoft Visual C++ for Windows, 16-bit edition, versions 1.0, 1.5, 1.51, 1.52
Microsoft Visual C++, 32-bit Editions, versions 1.0, 2.0, 2.1, 2.2, 4.0--------------------------------------------------------------------------------
SUMMARY
The Microsoft Foundation Classes (MFC) provide a CFileException class. The CFileException class includes public data members that contain operating- system errors and C Run-time errors that may be generated by certain file operations. MORE INFORMATION
The CFile and CStdioFile classes may throw a CFileException when certain error conditions occur; however, these classes do not throw a CFileException when the end of file is reached. If an application using the CFile or CStdioFile class needs to check for the end-of-file condition when reading from a file, the return values from the Read() and ReadString() member functions should be checked.CFile::Read returns the actual number of bytes read. If this number is less than the bytes requested, then the end of file has been reached.CStdioFile::ReadString returns a NULL pointer when the end of file has been reached.