home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
PASCAL
/
INDX18EU.ZIP
/
IWRITE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-03-20
|
2KB
|
101 lines
PROGRAM IWrite ;
USES
DOS ,
CRT ,
IndexedFiles ;
CONST
IndexedFileName = 'INDEXED' ;
TYPE
MyRec = RECORD
index : IndexStr ; { From UNIT }
name : STRING ;
age : BYTE ;
salary : REAL ;
occurance : INTEGER ;
phone : STRING ;
END ; { MyRec }
VAR
f : IFile ;
temp : MyRec ;
i : INTEGER ;
FUNCTION Index_Convert ( s : STRING )
: STRING ;
BEGIN { Index_Convert }
WHILE ( Length ( s ) < 10 )
DO
BEGIN
s := '0' + s ;
END ; { WHILE }
Index_Convert := s ;
END ; { Index_Convert }
FUNCTION StrNum ( n : LONGINT )
: STRING ;
VAR
s : STRING ;
BEGIN { StrNum }
Str ( n , s ) ;
StrNum := s ;
END ; { StrNum }
BEGIN
ClrScr ;
AssignIndexed ( f , IndexedFileName ) ;
ReWriteIndexed ( f ) ;
WITH temp
DO
BEGIN
occurance := 0 ;
salary := 250000.00 ; { Dreaming *sigh* }
age := 25 ;
name := 'Thomas E. Jenkins, Jr. ' ;
phone := '(803) 788-7179' ;
FOR i := 20 DOWNTO 2
DO
BEGIN
index := Index_Convert ( StrNum ( i ) ) ;
WriteLn ( 'Inserting index [' , index , '].' ) ;
WriteIndexed ( f , temp , SizeOf ( MyRec ) ) ;
IF ( fileError > 0 )
THEN
WriteLn( 'FILE ERROR !! : ' , IndexedError ( fileError ) ) ;
Inc ( occurance ) ;
salary := salary + 10000 ;
Inc ( age , 3 ) ;
END ; { FOR i }
END ; { WITH temp }
CloseIndexed ( f ) ;
END.