First off, this is for a class, I'm really trying to learn this and be able to do it on my own but when a hang up occurs and you only have 24 hours to finish it one must take drastic actions. So I plead for help from the learned ones...
I want to write the information stored in the 'Pets' array to a file called 'animals.txt...
I know that this code looks really twisted, I'm using a list to automatically populate my data members of the 'Animal' class.
Where am I going wrong?
I've excluded the 'Animal' class as I am not having any difficulty with it and did not think it was relevant for the problem that I'm having. Should anybody like to view it I'll post it immediately.
//initial code, initialization of data members....
//fstream theFile((char *) &Pets, ios::out | ios::app | ios::binary);
cout << "File object not created...";
theFile.open((char *) &Pets, ios::in | ios::binary);
cout << "Unable to open input file....";
theFile.read((char *) &Pets, sizeof(Animal));
for(int a(0); a < count; a++)
theFile.write((char *) &Pets[a++], sizeof(Animal));
if(a = 0)
if(a == count)
cout << "Total number of animals: " << count << endl;
cout << endl << "David Evans" << endl;
cout << "ITSE-2431.005" << endl;
cout << "May 2nd, 2002" << endl;
cout << "Unable to open file...";
Thanks a lot for any assistance, hints, and clues.