At 12:05 2007-02-08, Lars Finsen wrote:
>Den 8. feb. 2007 kl. 15.21 skrev Paul Herring:
> >
> > It is very rare that you should be using EOF functions directly in a C
> > or C++ program - you should instead be checking for an error in the
> > reading of data from a file. Then, and only then, should you be using
> > the EOF functions to determine if indeed it is the end of the file (or
> > someone's removed the floppy disc from the drive etc.)
>
>Why is that? I've always used it when reading from a text file.
>Checking for other errors usually isn't necessary.
>
> > Show your code!
>
>It's very simple. Essentially it goes like this:
>
>ifstream(filename) ui;
>while(!ui.eof())
>{
> if(baner==NULL) baner = b = new bane;
> else { b->neste = new bane; b=b->neste; }
> ui >> b->fork >> b->type >>....>> b->ist;
>}
>ui.close();
yup, exactly the code I said NOT to use in my other response (sorry
it's taken so long to get to my EMail this week)
>It reads all the actual lines correctly, but then goes on to read
>endless null lines. The file does contain linefeeds, but as far as I
>have understood, these are skipped when the skipws flag is set, which
>(as far as I have understood) it is by default.
>
>I am trying to convert from a half-automated system using MS Excel by
>converting the Excel table to text and reading the text file into the
>C++ program. Not quite decided on how to store the data in the C++
>system yet. It consists of several tables, corresponding to several
>classes in C++.
>
>LEF
>
>
>To unsubscribe, send a blank message to
><mailto:[EMAIL PROTECTED]>.
>Yahoo! Groups Links
>
>
>
Victor A. Wagner Jr. http://rudbek.com
The five most dangerous words in the English language:
"There oughta be a law"