You can actually worry about sending it to the port but I would recommend against this unless you have good reason. It's a lot simpler to simply send it to a text file opened to LPT1. That makes it a lot easier for network redirection and the like.
If you include the unit printer, there is a predefined text file variable lst you can use:
Code:
USES printer;
BEGIN
write(lst,'Hello printer!#12'); {Send a string followed by a FF}
END.
If you want to write to a specific port, you can try this:
Code:
VAR prn : text;
BEGIN
assign(prn,'LPT1'); {Other ports may be LPT2, ..., COM1, COM2, ...}
rewrite(prn);
write(prn,'Hello printer!#12'); {Send a string followed by a FF}
close(prn);
END.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.