I think I figured it out:
Code:
ClassData searchRecords(ClassData &obj, long recordNum)
{
ifstream fin(FILE_NAME2, ios::in | ios::binary);
if(!fin)
{
cout << "Cannot open file.\n";
exit(1);
}
fin.seekg(sizeof(ClassData) * recordNum, ios::beg);
fin.read((char *) &obj, sizeof(ClassData));
fin.close();
if(!fin.good())
{
cout << "A file error occurred.\n";
exit(1);
}
return obj;
}
I then used a for loop to search through everything read by the above function until I found matches then just stored that data in different member variables that I added to the original student class.
Thanks for the help!