home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
t
/
ter70.zip
/
PASCAL._XE
/
LSTPHONE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-09-26
|
1KB
|
48 lines
Program ListPhoneBook;
{ A small Terminate utility to show how to use the phonebook }
{ Structures are Copyrighted by Bo Bendtsen 1992 }
{$I PHONE.34}
Var
PhoneFile : File;
x : Word;
Procedure FatalError(s:string);
Begin
WriteLn('Fatal: '+s+#10#10);
Halt;
End;
Begin
FillChar(PHead34,Sizeof(PHead34),0);
Assign(PhoneFile,'TERMINAT.FON');
{$I-} Reset(PhoneFile,1); {$I+}
If IOResult=0 Then
Begin
{ Read the header in the phone file }
{$I-} BlockRead(PhoneFile,PHead34,Sizeof(PHead34)); {$I+}
If IOResult<>0 Then FatalError('Error in start of phonebook');
{ Read all records into structure }
For x:=1 to PHead34.Num Do
Begin
New(Ph34[x]); { Reserve memory }
{$I-} BlockRead(PhoneFile,Ph34[x]^.P,Sizeof(Ph34[x]^.P)); {$I+}
If IOResult<>0 Then FatalError('Error in phonebook, maybe wrong version');
End;
Close(PhoneFile);
End;
{ Write all phonenumbers on screen }
For x:=1 to PHead34.Num Do WriteLn(Ph34[x]^.P.Name);
{ Free memory before exiting }
For x:=1 to PHead34.Num Do Dispose(Ph34[x]);
End.