home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega CD-ROM 1
/
megacd_rom_1.zip
/
megacd_rom_1
/
MAGAZINE
/
INSIDE_T
/
ITPJAN90.ZIP
/
MAKEFILE.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-12-15
|
875b
|
52 lines
PROGRAM MakeFile;
USES Crt,Dos,FileUtil;
TYPE
TestRec=RECORD
Name: STRING[30];
Zip : STRING[5];
Amount : Real
END;
VAR F:FILE OF TestRec;
InRec: TestRec;
Ch:Char;
IOTest:Integer;
FUNCTION Ask : Boolean;
BEGIN
Write('Would you like to add a record (Y/N)?');
Ch:=ReadKey;
Ch:=UpCase(Ch);
WriteLn(Ch);
IF Ch = 'Y' THEN Ask:=TRUE ELSE Ask:=FALSE
END;
BEGIN
ClrScr;
FileMode:=66;
Assign(F,'testrec.dat');
{$I-}
Reset(F);
{$I+}
IOTest:=IOResult;
IF IOTest=2 THEN
Rewrite(F)
ELSE
IF IOTest <> 0 THEN IOError(IOTest);
FillChar(InRec,SizeOf(InRec),' ');
WHILE Ask DO
BEGIN
WITH InRec DO
BEGIN
Write('Name: ');ReadLn(Name);
Write('Zip Code: ');ReadLn(Zip);
Write('Amount: ');ReadLn(Amount);
END;
seek(F,FileSize(F));
Write(F,InRec)
END;
Close(F)
END.