Hi all - have the following code snippet

#include <iostream.h>
..
        ifstream is("menu.dat", ios::binary|ios::nocreate);
        while ( is.good() ) {
// Read a record in, then add it to the menu
                is.read((char*)&item1, sizeof(menu_item));
...

however, item1 never gets changed when that line is run, and a is.rdstate
returns 3.  also, it only does one loop, so when it hits the is.good check
the 2nd time, it falls out.  I know that the file has more than enough data
to prevent reaching eof.  It was written w/2 calls to
    os.write((char*)&item1, sizeof(menu_item));

I am at a loss.  I have also tried to replace the menu_item (name of class)
w/ item1 to no avail.



73,
Chuck
N1SPX

Reply via email to