• C

printing

if i am using fputchar
how do i send it to the printer?
shorty225Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
The Lifecycle Approach to Managing Security Policy

Managing application connectivity and security policies can be achieved more effectively when following a framework that automates repeatable processes and ensures that the right activities are performed in the right order.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.