Solved

CFileException

Posted on 1998-12-29
2
1,067 Views
Last Modified: 2013-12-03
I'm trying to catch "end of file" by using CFileException.
I have code in a try/catch block and when EOF occurs the catch part doesn't work.  My program goes on forever in what appears to be an endless loop.  Any working examples or help would be greatly appreciated!  Thanks, Kelvin
0
Comment
Question by:drivers102797
2 Comments
 
LVL 8

Expert Comment

by:MikeP090797
Comment Utility
Post your code here, so we can see what is wrong and try to fix it
0
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
Comment Utility
Sorry, no exception is thrown when EOF is reached (as this isn't necessarily an error). To detect this, check the return value of 'CFile::Read()'. If it is less than the number of bytes requested, you're at the end...
begin quote-->
CFile::Read
virtual UINT Read( void* lpBuf, UINT nCount );
throw( CFileException );

Return Value

The number of bytes transferred to the buffer. Note that for all CFile classes, the return value may be less than nCount if the end of file was reached.

<-- end quote

Feel free to ask if you need an example...

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now