// Recovery.C

#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <errno.h>
#include "GuestInfo.h"
#include "IODetails.h"

main()
{
  cout << "Guest Data recovery" << endl;

  const char dbname[] = "guestDB.txt";

  ofstream outFile(dbname,
  	      ios::out | ios::noreplace);

  if (!outFile) {
    cerr << "Cannot open " << dbname
         << ": " << strerror(errno)
         << endl;
    return 1;
  }

  GuestInfo g;

  while (cin >> g) {
    outFile << g.name << endl;
    outFile << " "<< g.address << endl;
    outFile << " " << g.roomNumber << endl;
    outFile << " " << g.charges << endl;
  }

  return 0;
}
