Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CFileException

Posted on 1998-12-29
2
Medium Priority
?
1,081 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 8

Expert Comment

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

Accepted Solution

by:
jkr earned 300 total points
ID: 1417830
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

618 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