home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / btree / btriev14 / clone.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-10-27  |  900 b   |  31 lines

  1. PROGRAM Clone;               { (C) 1991 John C. Leon   last updated 10/19/91 }
  2.  
  3. {$IFDEF production} {$D-,R-,L-,S-} {$ENDIF}
  4.  
  5. USES
  6.    BTP;
  7.  
  8. VAR
  9.    OrgName, CopyName : string[79];
  10.    OrgFile           : PBFile;
  11.  
  12. BEGIN
  13.    write('Enter name of file to clone: ');
  14.    readln(OrgName);
  15.    write('Enter name of file to create: ');
  16.    readln(CopyName);
  17.    OrgFile := new(PBFile, Init(OrgName, ReadOnly));
  18.    if BStatus = 0 then   {if original file exists and no error on open op}
  19.       begin
  20.       BStatus := CreateFile(CopyName, @OrgFile^.Specs);
  21.       if BStatus = 0 then
  22.          writeln(CopyName, ' created successfully.')
  23.          else
  24.          writeln('Error creating ', CopyName, '.  Status = ', BStatus, '.');
  25.       BStatus := OrgFile^.Close;
  26.       dispose(OrgFile, Done);
  27.       end
  28.       else
  29.       writeln('Error opening ', OrgName, '.  Status = ', BStatus, '.');
  30. END.
  31.