This is some really old code from my college days. we were given it to look at but TP doesnt like printing on my printer so Ive never used it
{***********************************************************************}
PROGRAM print_report;
{Program to sned a single text sting to the printer
connected to port LPT1. A form feed ejects the paper}
USES
crt,printer;
{The inclusion of the CRT unit gives access to screen function
The printer unit contains printer functions and allows the printer
to be be written to as a text file, but the printer does not need
to be assigned, opened or closed. The printer control can be acheived
by writing ASCII number (in decimal) to the printer.}
{Important Note: Care and patience is rquired when testing procedures
and functions that interact with printers. The consequences are not
always immediately apparent}
TYPE
nums=RECORD
min:INTEGER;
max:INTEGER;
END;
numfile=FILE OF nums;
{************************************************************************}
PROCEDURE InitialiseFiles(VAR reportheader:TEXT;VAR reportfooter:TEXT;VAR datafile:numfile);
VAR
ind:INTEGER;
maxmin:nums;
BEGIN
ASSIGN(reportheader,'A:HEADER.TXT');
ASSIGN(reportfooter,'A:FOOTER.TXT');
ASSIGN(datafile,'A

ATA.DAT');
{Put max and min number into the data file}
REWRITE(datafile);
SEEK(datafile,0);
FOR ind:=1 TO 2 DO
BEGIN
maxmin.min:=2;
maxmin.max:=8;
write(datafile,maxmin);
END;
CLOSE(datafile);
END;
{************************************************************************}
{************************************************************************}
PROCEDURE PrintFile(VAR thefile:TEXT);
VAR
str:STRING;
BEGIN
RESET(thefile);
WHILE NOT EOF(thefile) DO
BEGIN
readln(thefile,str);
writeln(LST,str);
write(LST,#10#13);
END;
CLOSE(thefile);
END;
{************************************************************************}
{************************************************************************}
PROCEDURE PrintReportData(VAR datafile:numfile);
VAR
ind,total,count:INTEGER;
average:REAL;
figs:nums;
BEGIN
total:=0;
count:=0;
write(LST,#10#13);
write(LST,'The Report');
write(LST,#10#13);
reset(datafile); {Contains only two records}
while (NOT EOF(datafile)) DO
BEGIN
read(datafile,figs);
write(LST,figs.min,' ',figs.max);
write(LST,#10#13);
total:=total+figs.max+figs.min;
count:=count+2;
END;
average:=total/count;
write(LST,' count = ',count);
write(LST,#10#13);
write(LST,' average = ',average:2:2);
write(LST,#10#13);
END;
{************************************************************************}
{************************************************************************}
PROCEDURE FinishPrintingReport;
BEGIN
write(LST,#10); {write line feed 10 decimal to printer}
write(LST,#13); {write carraige return 13 decimal to printer}
write(LST,#12); {write form feed 12 decimal to printer}
write(LST,#27,#69); {write reset printer, escape (dec27) End (dec 69)}
write('Press ENTER to Continue');
readln;
END;
{************************************************************************}
{*************************MainProgram************************************}
VAR
reportheader:TEXT;
reportfooter:TEXT;
datafile:numfile;
BEGIN
clrscr;
InitialiseFiles(reportheader,reportfooter,datafile);
PrintFile(reportheader);
PrintReportData(datafile);
PrintFile(reportfooter);
FinishPrintingReport;
END.
{***************************TheEnd***************************************}
~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."