Pascal Help (Sorry if it is the wrogn forum)
I dont think this is the right forum but i coudltn find one for it. I have a pascal question.
I have this code right here that lets peopel choose if they want to send output to the printer or the monitor. It works fine in Turbo Pascal but in a new version of pascal called TMT Pascal, i get a runtime error (code number #2) no file found.
Code:
PROCEDURE Redirect(var outfile:Text);
(*Allows user to chose between the screen or printer*)
CONST
Yes: Set of char=['Y', 'y']; (*y or Y will send to printer*)
VAR (*Stores what user says*)
Answer: Char;
BEGIN
Clrscr; (*Clears the screen*)
Writeln('Should the ouput be sent to the printer?');
Writeln;
Writeln('Press the "Y" key for "yes"');
Writeln('Press any other key for "no"');
Writeln;
Readln(Answer); (*Gets the sanswer*)
IF(Answer in Yes)
THEN
Assign(outfile, 'lpt2') (*Going to printer*)
ELSE
Assign(outfile, 'CON'); (*Going to Screen*)
Rewrite(outfile);
END; (*End Procedure redirect*)
(*****************************************************************************)