output to a printer

I was trying to send output to a printer. Here's what I've done:

1
2
3
ofstream printer(); // I know I would need some kind of path here...
printer << "Hello, world";
printer.close();


THe thing is, what should I put in the parens on line 1 so that my ofstream object is really connected to the printer?
Last edited on
I don't think that it will on Windows, otherwise ofstream it's a file stream, why do you think that it's a printer?
In a Linux systems all devices(including printers) are files(so it maybe work on Linux, but I am not shure)
You can use the UNC name of the printer. But if it's expecting postscript you won't see your output.
Okay, then lemme put it this way, how do I send output to a printer, instead of the monitor?
Topic archived. No new replies allowed.