Alright basically I'm trying to make a C++ program that will store structures of data into a file which can be displayed later in the same program. Here is pseudo-ish code from the problematic part of my program:
file.read((char*)&data, sizeof(dataStructure));
while (!file.eof())
{
display(data);
file.read((char*)&data, sizeof(dataStructure));
}
This does what it is supposed to, loops through the file and displays the contents. The issue is that after it is done and I come back to this part of the code WITHOUT closing the file and reopening, the file pointer appears to remain at the end of the file. I've tried adding things like:
seekg(0);
// or
seekg(0, ios::beg);
But neither work. Any ideas? I'm a little bit of a nub in C++ but any help would be appreciated.