line 17 is probably the wrong way to determine if the file is empty or not. What you should do is seek to end of file then get the file position.
instaffile.seekg(0, ios::end);
size_t sz = instaffile.tellg();
if( sz == 0)
{
staffid = 1;
return;
}
The loop at lines 24-28 is also wrong
instaffile.seekp(0, ios::beg); // go to beginning of tile
count = 0;
while( instaffile.read(reinterpret_cast<char *>(this),sizeof(staff))
{
++count;
}
Last edited by Ancient Dragon; Nov 3rd, 2009 at 1:11 am.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Offline 21,963 posts
since Aug 2005