eof() is there a better way

From: Satan (NoSpam_at_)
Date: 03/31/04


Date: Tue, 30 Mar 2004 17:49:56 -0800

Hi,

I am always having trouble with the following:

while ( !read_file.eof()){
        // do something
}

Looping again when i think the file should be empty.
It even loops when i have created a new file with
nothing in it (editor - vi).

Is there a better way to ensure you are at EOF ?

Thanks



Relevant Pages

  • Re: eof() is there a better way
    ... > I am always having trouble with the following: ... > Looping again when i think the file should be empty. ... > It even loops when i have created a new file with ...
    (alt.comp.lang.learn.c-cpp)
  • RE: need help
    ... there is no good way to learn loops except for doing lots of them. ... If it is empty we are going to get the value in column A which is the ... RowCount = RowCount + 1 ... "Jim May" wrote: ...
    (microsoft.public.excel.misc)
  • Re: rnd(0)*X in Assembler?
    ... I did an analysis of what would happen if I used a Random Lookup ... rather than using a Random function that loops back if out of range. ... looping if you're out of range means sometimes a lot of what I consider ... plenty of computing time, it makes sense to generate a new Lookup Table, ...
    (comp.sys.cbm)
  • Re: Would like to loop
    ... On Jan 16, 6:43 pm, John W. Vinson ... The code compiles and it loops through it all but only updates the ... Avoid the entire problem by using an Append query rather than looping through ...
    (microsoft.public.access.gettingstarted)
  • Re: Random Extension
    ... It loops through the items and check for each item if it should keep it or not. ... The first element has a 50% chance of being picked, the second one chance in 6, the third a smaller number and so on. ... In order to achieve an equal probability, I think that the only way to do it requires to know the number of elements in advance, and if you only have an IEnumerable interface, this requires looping through the entire collection before being able to choose the "random" item to be returned. ...
    (microsoft.public.dotnet.languages.csharp)