Hi all
I have a function writetofile() which save a record to a file but the problem is when its writting to a file it doesnt write the record in a correct order, here is the code for WriteToFile()
void StudentC::WriteToFile()
{
ofstream Outfile;
Outfile.open("File\\Student.txt", ios::app);
Outfile << Count << endl;
Outfile << StudentNo << endl;
Outfile << Name << endl;
Outfile << Surname << endl;
Outfile << Gender << endl;
Outfile << DateOfBirth << endl;
Outfile << Mark << endl;
Outfile.Close();
}
Now the problem is when it is saving a record to a file it 1st write the Count which is correct, from there it writes the Name instead of StudentNo, followed by Surname, DateofBirth, Gender, Mark and StudentNo, if u know why it is messing up my record please I need ur help urgent, coz the order should be like the way it is on the WriteToFile() method but it isnt, I hope this make sense
Thanks in Advance