• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

printing

if i am using fputchar
how do i send it to the printer?
0
shorty225
Asked:
shorty225
  • 3
  • 2
  • 2
  • +2
2 Solutions
 
shorty225Author Commented:
if i am using putchar
how do i get it to print to the printer
0
 
Sys_ProgCommented:
Here's the help for putchar


Function: int putchar (int c)

The putchar function is equivalent to putc with stdout as the value of the stream argument.


Here's the help for putc

Function: int putc (int c, FILE *stream)

This is just like fputc, except that most systems implement it as a macro, making it faster.  One consequence is that it may evaluate the stream argument more than once, which is an exception to the general rule for macros.  putc is usually the best function to use for writing a single character.

Thus, I think u should use putc for your task
0
 
shorty225Author Commented:
my chararters are coming in from a file
its like 20 lines per page
is there anyway fputchar will print this to the printer
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
g0rathCommented:
under linux, you can print to the /dev/lp0 device
under windows, you can go to lpt1 etc...

under linux you could pipe  your data to lpr/lpd and send your output to a remote printer.

The first do will all use the buffered file I/O family of functions

fprintf
fputs
fputchar
fputc

The other would require pipes and a little more effort
0
 
ankuratvbCommented:
sure it can.

putchar(c,PRN);

where c is the character to print.
PRN is defined as the printer port
0
 
ankuratvbCommented:
FILE *prn;
char c;
prn=fopen("PRN","wb");
putchar(c,prn);
fclose(prn);

Or on some systems:

prn=fopen("LPT1","wb");

Another one:

prn=fopen(stdprn,"wb");

On my system,all 3 work.

I guess i am too late on this one as well.
0
 
ankuratvbCommented:
sorry,replace putchar with fputc.
0
 
g0rathCommented:
yeah, guess the original guy wasn't really that interested...we've all answered these with good answers, but I guess without the original guys response it would be better to split the points since they are all "accurate" but who knows which way the original guy would have wanted since there is more then one way do this operation depending on OS, needs, etc...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now