home *** CD-ROM | disk | FTP | other *** search
- PROGRAM Stats; { (C) 1991 John C. Leon last updated 10/19/91 }
-
- {
- This program will report stats on ANY Btrieve file. Just supply the name of
- any valid Btrieve file on the command line or when prompted. We are not
- concerned with the record layout of a file at all in this example program.
- We just want stats, to illustrate use of the BFile object.
- }
-
- {$IFDEF production} {$D-,R-,L-,S-} {$ENDIF}
-
- USES
- BTP;
-
- VAR
- Example : PBFile;
- MyFileName: string;
-
- BEGIN
- if paramcount < 1 then
- begin
- write('Enter name of a Btrieve file: ');
- readln(MyFileName);
- end
- else
- MyFileName := paramstr(1);
- Example := new(PBFile, Init(MyFileName, ReadOnly));
- if BStatus <> 0 then
- writeln('Error initializing Btrieve file object. Sorry!')
- else
- begin
- writeln;
- writeln('Btrieve file name: ', MyFileName);
- writeln('----------------------------');
- with Example^ do
- begin
- writeln('Record length is: ', Specs.RecLen);
- writeln('Page size is : ', Specs.PageSize);
- writeln('Number keys : ', Specs.NumKeys);
- writeln('Number segments : ', NumSegs);
- writeln('Number records : ', NumRecs);
- writeln('----------------------------');
- BStatus := Close;
- end;
- if BStatus <> 0 then
- writeln('File could not be closed. Status = ', BStatus);
- end;
- dispose(Example, Done);
- END.
-