Append.h


This is the Append( ) method of the class Record, which adds the new record to the end of the file. It is called when no slots in the avail list are found. The second integer of the file, the offset of the last record, has to be adjusted too.

 ~wenchen/public_html/cgi-bin/351/week7/Append.h 
#include  <fstream>
  using namespace std;

void  Record::Append( fstream& file ) {
  int   last;
  char  str[10];

  file.seekp( 0, fstream::end );
  last = file.tellp( );
  file << FixedLen( GetSize( )+1, str, 6 ); 
  file << FixedLen( last, str, 5 );
  file << ' ' << buf << '\n'; 
  file.seekp( 6, fstream::beg );
  file << str;
}