Printers and Portability
I was wondering if there was a good portable way to send information to a printer? Using fstreams will not work with my setup (windows xp and an ink jet printer) and the only other way I know of is with windows api's which (correct me if I am wrong) will only work on a windows OS.
I have been playing with pdCurses and I like it so far. I would like to start using it on a regular basis but I have not seen anything on printer functions for it and I would hate to have to #include <windows.h> just so that I can send text to the printer.
Assuming you have a printer connected to the LPT1 port, you create an ofstream object and open lpt1.
EDIT: Oh... you said portable... I'm not sure if lpt1 is recognized as a printer port under other systems. Most probably not.
> I was wondering if there was a good portable way to send information to a printer?
There is no standard device name for a printer, nor is there a standard way of finding out if you've even got a printer.
Not to mention the vast variety of printers and printer languages (PCL, Postscript, ... )
Try one of the cross-platform UI frameworks like Qt, GTK+ or wxWidgets. They ought to provide printing.
FYI - Some printers have a special secret protocol that requires you to use the Windows driver (and WinAPI). I have a cheap Canon ink jet, and it doesn't respond if you simply it send ASCII. It won't work with DOS applications at all.