?
Solved

CFileException

Posted on 1998-12-29
2
Medium Priority
?
1,079 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

762 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