I have a problem in reading binary file.
When i count the number of record, it is correct.
But when i try to display the information of the file, the result is 1x0.
Hope someone can guide me. Thanks...
This is part of my code...
Student aStudent;
Student *pStudent;
ifstream ins;
int byte_size = 0, no_rec = 0;
ins.open("Students.dat", ios::in | ios::binary);
ins.seekg(0, ios::end);
byte_size = ins.tellg();
no_rec= byte_size / sizeof(Student);
cout << "Number of records in file is: " << no_rec<<endl;
pStudent = new Student[no_rec];
ins.seekg(0, ios_base::beg);
ins.read((char*)&pStudent, no_rec*sizeof(Student));
cout << pStudent << endl;
ins.close();
Lot of help,
Ken JS