Yes, but Im confused about the idea of f.eof(). For example I put 6 element to 
a file. Ive read the 6th element. If i test f.eof(), will it return false, or 
do I have to read it one more time, and then test f.eof()?

Thanks in advance :)


--- On Fri, 10/10/08, David Hamill <[EMAIL PROTECTED]> wrote:

> From: David Hamill <[EMAIL PROTECTED]>
> Subject: Re: [c-prog] Re: Loop to Read Binary File
> To: [email protected]
> Date: Friday, October 10, 2008, 5:26 AM
> Jos wrote:
> > I mean isnt if(!f.eof()) equal to while(!f.eof())?
> 
> Well no, one is a conditional and the other is a loop 
> involving a conditional! ;-)
> 
> If one's in doubt about loop semantics, or the standard
> 
> constructs don't seem to fit one's problem,
> it's often 
> helpful to use a while (1) or for ( ; ;) infinite loop with
> 
> break, and do all the condition checking and incrementing
> of 
> variables yourself inside the loop. That way you know 
> exactly what's going on, and when.
> 
> Although the standard loop constructs are very useful, 
> sometimes it's better to roll your own.
> 
> David


      

Reply via email to