Language:
Русский
English
{AbortPrn.PAS}
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
{Sample code for AbortPrn, AssignDefPrn and TitlePrn procedures}
uses WinPrn, WinCrt;
var
Source, Prn: Text;
Name: array[0..80] of Char;
Line: String;
begin{ Read the name from the user }
Write(' Enter file to print: ');
Readln(Name);
Assign(Source, Name);
Reset(Source);
AssignDefPrn(Prn);{ Open a file to the default printer }
TitlePrn(Prn, Name);
Rewrite(Prn);
Writeln(' Printing file: ', Name);{ Print the file }
while not Eof(Source) do
begin
Readln(Source, Line);
Writeln(Prn, Line);
{ Terminate the printing if the user presses ESC }
if KeyPressed and (ReadKey = #27) then
begin
AbortPrn(Prn);
Break;
end;
end;
Close(Source); { Close the files }
Close(Prn);
end.