what am I doing wrong
Can someone please tell me what I am doing wrong.
I am trying to get this program to have input from a user, then write that
input to a binary file.
If someone can help me thanks.
Program Assign4;
{}
uses CRT;
Type bookin=RECORD
title:string[30];
AuthorLastName:string[15];
AuthorFirstName:string[15];
Publisher:string[25];
ISBN:string[13];
end;
bookfiletype=FILE of bookin;
var
bookfile:bookfiletype;
book:bookin;
procedure addrec;
var
infile:string;
titlein:string;
errorcode:integer;
begin
writeln('please enter file name');
read(infile);
assign(bookfile,infile);
{$I-}
reset(bookfile);
Errorcode:=IORESULT;
{$I+}
if errorcode = 2 then
begin
rewrite(bookfile);
write('Please enter book title');
readln(titlein);
write(bookfile,titlein);
end
else
begin
writeln('File ', infile,' not found');
writeln('Please enter correct filename');
write('Press ENTER to continue');
readln;
end;
write('Please enter book title');
readln(titlein);
write(bookfile,titlein);
end;
procedure menu;
var
option:char;
begin
repeat
clrscr;
write('A');
writeln(' Add a new book to inventory');
write('D');
writeln(' Delete a book from inventory');
write('F');
writeln(' Find and display all books by specified author');
write('L');
writeln(' List entire inventory');
write('Q');
writeln(' Quit');
writeln('Please enter an option: ');
readln(option);
case option of
'A','a': begin
addrec;
end;
'D','d': begin
{deleterec;}
end;
'F','f': begin
{findndisplay;}
end;
'L','l': begin
{listin}
end;
end;
until (option='Q') or (option='q');
end;
begin
menu
end.