No it's not being opened in binary. It's in text mode. Here's how I play with it:
Code:
obook.open("books.dat", ios::ate);
if (obook){
newBook = Book(isbn, author, title, publisher, pPlace, status, year, copy);
obook.write(reinterpret_cast< char * >(&newBook), sizeof(Book));
obook.close();
newBook.show();
cout<<"\n\nBook data written successfully.";
getch();
}
else{
cout<<"\n\nCannot open transaction file."<<endl;
getch();
return;
}
That's pretty harmless isn't it? I mean it works most of the time without a problem! I just don't understand why simple code can go rouge sometimes.
As for making sure if it is still good(), to be perfectly honest with you, I was never taught that. What's that?
Thanks again Codeplug.