The very basics looks like this and prints to the default printer:Does this work in FP.EXE ???
@Rik: You obviously didn't try my code (again). >:DHow do you mean "again" ?? I always try code. So I don't see what you mean with again. I think you got me confused with someone else.
@Rik: You obviously didn't try my code (again). >:DHow do you mean "again" ?? I always try code. So I don't see what you mean with again. I think you got me confused with someone else.
I did try your code and it says it can't find unit printers.
The only unit printers I can find is in Lazarus LCL. I can't find one in FPC. Can you direct me where I can find the unit printers in FPC? There is a unit printer (without the s) but that only creates a PRN-file assignment (which would normally be LPT1 as I remember).
Edit: So YOU didn't try your code in FP.EXE >:D
Anyway. It works. so submitter's question is answered.Does it work in FP.EXE???? OP is using the textmode version of Free Pascal.
Having used Turbo Pascal for many years I am quite happy using the textmode version of Free Pascal - but, out of curiosity, is it possible to access my Windows printer by using the Printers unit?
The very basics looks like this and prints to the default printer:Thaddy... I also tried to find AssignPrn function in LCL/Printers.pas but I can't find it anywhere in LCL/Lazarus or FPC. Do you know where it's defined?
Doesn't FP IDE use printer (http://www.freepascal.org/docs-html/rtl/printer/index.html) unit from RTL?Yes, FP IDE uses that printer unit.
(afaik PRN is not a parallel port, but a pseudo device that is an alias for the true port (typically LPT or COM))Can you redirect PRN to a COM port? (I never seen PRN as COM port)
The printer unit is for TP compatibility so limited.
Afaik with "mode lpt" you can redirect it to serial. It only /defaults/ to prn.Yes, you can redirect LPTx to COMx. But you can't directly change the PRN to a COMx.
I couldn't quickly find the exact command, but wikipedia confirms the ability: https://en.wikipedia.org/wiki/DOS#Reserved_device_names