• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Printing in c++

DarkKnight69

Golden Member
I am building a program in win32 console and I am looking to know how to make the computer print what is displayed on the screen. How do I go about doing it?

I have been googling for over an hour now to no use that I can see...
 
Take a Print Screen and paste it into Paint or something then print it? Or do you mean printing to the screen, if thats the case, then cout
 
Do you mean inside your program sending output to a printer?

There is nothing in win32 for console output to printers, though you might find a third-party library that does this someplace like www.CodeProject.com

Printing in win32 is via GDI, just like drawing to a display window.
 
Originally posted by: DarkKnight69
Originally posted by: Aikouka
http://www.reviewsonline.com/QA-C.htm

Took a second on google to find 😉.

Thanks, that is what I was looking for and could not find!

Took me more than one search to get it. I'm pretty stern on the idea that searching Google is more of an art than people make it out to be as knowing just the right keywords can make and break a search.

Originally posted by: DaveSimmons
Good find. I'd expect that to work with a printer attached directly to the parallel port if it still accepts dumb ASCII text output, but I wonder if it will work with USB and bitmap-only printers? (It might, I'm too lazy to check)

Not too sure how it works, but it does stress "local printers" and not specifying printers only on a parallel port. The only times I ever had to print in college were just to hand programs in and all we used was redirection and them printed them normally :x.
 
Originally posted by: jman19
That's probably not what he meant.

Actually, the one example in the link I gave does use cout via modifying the object that it points to (changing it from stdout to the printer).
 
Originally posted by: Aikouka
Originally posted by: jman19
That's probably not what he meant.

Actually, the one example in the link I gave does use cout via modifying the object that it points to (changing it from stdout to the printer).

I think I misunderstood DarkKnight's question. I was under the impression he wanted a screen shot or something.
 
Originally posted by: DarkKnight69
Originally posted by: oog
redirect the output to a file and print that

That is also a good idea, though I do not recall how to format from c++ into a text file...

outData.open("text.txt");
outData << "Text text text" << endl;
outData.close();


Like that?
 
Back
Top