Printing in c++

DarkKnight69

Golden Member
Jun 15, 2005
1,688
0
76
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...
 

cchase88

Member
Feb 12, 2007
51
0
0
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
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
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.
 

Aikouka

Lifer
Nov 27, 2001
30,383
912
126
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.
 

Aikouka

Lifer
Nov 27, 2001
30,383
912
126
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).
 

jman19

Lifer
Nov 3, 2000
11,225
664
126
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.
 

RaiderJ

Diamond Member
Apr 29, 2001
7,582
1
76
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?