[fpc-pascal] New to FPC: Printer problems

Tom Backer Johnsen backer at psych.uib.no
Tue Jun 9 11:02:27 CEST 2009


I have just recently downloaded FPC / Lazarus with the plan of porting 
some Delphi 7 programs (Windows XP).  Then I am encountering some some 
errors where I thought was a trivial task.

I want to print the contents of a plain text file to the default 
printer, adding some frills like page headers and such to the pages in 
the process.  What I have done is to include Printers in a uses 
declaration, and declare Prn as a type TextFile.  Then something like:

AssignPrn(Prn);
Rewrite (Prn);
for ...  begin
    writeln (Prn, ....);
    end;
Closefile (Prn);

Then I find that there is no such thing as "AssignPrn".  I have to add 
that I have used Delphi 7 and its predecessors for a long time and may 
have acquired bad habits which work under Delphi 7 but is  doubtful.

Is it possible for someone to provide a code snippet for this seemingly 
trivial task?

Tom



More information about the fpc-pascal mailing list