keep getting Error 63 Invalid File Type

I keep getting this error on line 16 of the program. I have looked through all my books and can't figure out what the problem is. The program does create a size zero file called REPORT.BAT.

PROGRAM transbat (INPUT,OUTPUT);
TYPE
vgr = file of char;
text = file of string;
backweek = file of char;
VAR
LTRCODE : STRING;
report : text;
h : integer;
BEGIN
writeln('Enter the three letter company code: ');
readln(LTRCODE);
{CREATE FILE}
ASSIGN (report,'REPORT.BAT');
REWRITE (report);
WRITELN (report,'c:');
WRITELN (report,'CD');
WRITELN (report'PKZIP -rP -t C:VGRREPORT',LTRCODE,' C:',LTRCODE,'?????REP.*')
WRITELN (report,'CD VGR');
WRITELN (report,'VGR TRANSFER REPORT',LTRCODE);
CLOSE (report);

END.

Comments

  • forgot to mention I'm using tp6.

  • : I keep getting this error on line 16 of the program. I have looked through all my books and can't figure out what the problem is. The program does create a size zero file called REPORT.BAT.
    :
    : PROGRAM transbat (INPUT,OUTPUT);
    : TYPE
    : vgr = file of char;
    : text = file of string;
    : backweek = file of char;
    : VAR
    : LTRCODE : STRING;
    : report : text;
    : h : integer;
    : BEGIN
    : writeln('Enter the three letter company code: ');
    : readln(LTRCODE);
    : {CREATE FILE}
    : ASSIGN (report,'REPORT.BAT');
    : REWRITE (report);
    : WRITELN (report,'c:');
    : WRITELN (report,'CD');
    : WRITELN (report'PKZIP -rP -t C:VGRREPORT',LTRCODE,' C:',LTRCODE,'?????REP.*')
    : WRITELN (report,'CD VGR');
    : WRITELN (report,'VGR TRANSFER REPORT',LTRCODE);
    : CLOSE (report);
    :
    : END.
    :

    You cannot use WriteLn on typed files. And as much as you have defined report as type text, you have overridden the default pascal text type as file of string. I would try removing that line and trying to recompile then.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories