Hi again. I wrote 4 instances of a structure to a .dat file. I called them north, south, east, and west. I created a new program to read that file and display the data. I am using the below loop. I am trying to JUST read the north data. I keep getting only half the data using what i am doing below. What am i doing wrong? What should i be doing to read just one of the structures from the file.
Each structure for example has a Name, and the QTR #, and the sales figures for 4 quarters. I want to display the figures for all 4 qtrs for just the north in this case.
file1.read ( reinterpret_cast<char*>(&north), sizeof(north) );
cout << "Info for the " << north.divName << " division: " << endl;
while ( file1.read ( reinterpret_cast<char*>(&north), sizeof(north) ) )
{
cout << "Sales QTR " << north.qtr << ": " << north.salesPerQtr << endl;
file1.read ( reinterpret_cast<char*>(&north), sizeof(north) );
}
Any help or advice is greatly appreciated. Thanks again!