Solved

CFileException

Posted on 1998-12-29
2
1,076 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 100 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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 Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 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