Ok, I didn't include all of my code, just the portion that is giving issues.

Code:
class book{
   private:
      int isbn;
      string name, author;
   public:
      //usual constructors, accessors, mutators, destructors etc. etc.
};

void main (void)
{
   int ISBN;
   string Name, Author;
   book bk;
   
   cin<<ISBN;
   //these getlines don't work for me, but it works for  you guys so I'm putting it here anyway
   getline(cin, name);    
   getline(cin, author);

   bk = book(ISBN, Name, Author); //initialise variable

   ofstream outbook("books.dat", ios::binary); //open file

   //createBook returns a bool if it can create the file.
   //createBook is a separate function not shown here.
   if (!outbook)
      if (!createBook){
         cout<<"System error: Unable to create file on disk.";
         getch();
         exit(1);
         }

   //write the data to the file - this works fine.
   outbook.seekp((newBook.getISBN() - 1) * sizeof(Book));
   outbook.write(reinterpret_cast< const char * >(&newBook), sizeof(Book)); 

   cout<<"\n\nBook data written successfully.";

   outbook.close();

   //open the file for data retrieval
   ifstream inbook("books.dat", ios::in);

   //if the file was not already created
   if (!inbook){
      cout<<"No customer database exists.";
      getch();
      exit(1);
      }
   
   //this is the line that is giving issues. The line is syntax error free.
   inbook.read(reinterpret_cast< char * >(&bk), sizeof(book));

   while (inbook && !inbook.eof()){
      if (bk.getId() != 0){

         bk.list(); //'list()' is a member function of the book class, 
			}
       inbook.read(reinterpret_cast< char * >(&bk), sizeof(book));
      }
      
}
It is at the highlighted lines that the error occurs.
My take on it is that strings can't be written and read via files.

Could someone kindly confirm or deny my claims please? I'd greatly appreciate it. Thanks.