Writing goes fine, evrythin in the binary file is just the way it should be, only problem i am havin is with reading. At one point my code will just start to spurt strange BS.
Code:
Book* New;
DB_in.open("db.raw", ios::in || ios::binary);
for(int i = 0 ; i < SizeOfDB; i++)
{
if(!FreeStack.ElementOfFreeStack(i))
{
New = new Book;
DB_in.seekg((i * sizeof(Book)), ios::beg);
DB_in.read((char *)New, sizeof(Book));
Main->Insert(New);
}
}
think the problem is in my logic up there... SizeOfDB is the total number of books in the binary file. Tryed just runnin along trying to get the next book every time but that didn't work so i started to jump from the start everytime. Kinda hard for me to post all of the code cause there is simply to much but kinda limited the problem to the code above using the debugger.
If you see any obvious mistakes or got suggestions on what i should do/try plz lemme know, kinda n00b at binary file i/o.
Thnx in advance