Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help redirecting output to printer

Status
Not open for further replies.

tbuch

Programmer
Oct 17, 2000
80
US
I am a C++ newbie and my book makes absolutely no reference to outputting to a printer. Can anyone please give me a simple sample of the syntax for directing output to a printer and what header file must be included?
Thanx...Tim
 
You can actually print to the printer by
using the standard "C" routine fopen().

First you need to find the port to which
the printer is attached to on your machine.
Then you can print stuff with a few lines
of code.

For egs, assuming your printer is attached
to the port "LPT1",

FILE *fp = fopen("LPT1","w");
fprintf(fp,"What's up, Doc?\n");
fclose(fp);

You can print with these 3 lines only.
For a full discussion on this ,I suggest
you try this link,


Hope this was useful.
Regards,

Anand Pillai
(anand_pillai@delmia.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top