Does anybody have a tested function in C or C++ that sends text to the printer in a Windows Console Application? I would be very appreciative!

It would be nice, if I could specify the font. Yes, I can google!

Re: TextOut to Printer function desired. 80 80

The easiest solution is to first try opening one of the following streams:

ofstream pout("PRN");
ofstream pout("LPT1");
ofstream pout("PRN:");
ofstream pout("LPT1:");

If none of those work, and your compiler doesn't support an extension for talking to a printer, google over to MSDN and see what you can find. But don't use the MSDN search feature, it really bites.

Re: TextOut to Printer function desired. 80 80

Narue,

thanks a lot! I will test drive your suggestion!

Re: TextOut to Printer function desired. 80 80

If you don't mind using the old FILE structure, you can print by using:

FILE *fp;
fp = fopen(prn, w);
fprintf(prn, "%s", charstr);

Re: TextOut to Printer function desired. 80 80

i want to print the report on printer.

which function plz tell me

commented: Don't bump old threads -1
Re: TextOut to Printer function desired. 80 80

i want to print the report on printer.

which function plz tell me

Lol? They just told above. And what report?
Elaborate if you want any kind of help, and please include why you think the two previous suggestions are useless :)

Re: TextOut to Printer function desired. 80 80

can anyone give example of this printer statement??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.