Solved

printing

Posted on 2003-11-04
12
246 Views
Last Modified: 2010-04-15
if i am using fputchar
how do i send it to the printer?
0
Comment
Question by:shorty225
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
12 Comments
 

Author Comment

by:shorty225
ID: 9684050
if i am using putchar
how do i get it to print to the printer
0
 
LVL 10

Expert Comment

by:Sys_Prog
ID: 9684270
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
 

Author Comment

by:shorty225
ID: 9684285
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
Industry Leaders: 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!

 
LVL 45

Accepted Solution

by:
sunnycoder earned 250 total points
ID: 9684300
0
 
LVL 5

Assisted Solution

by:g0rath
g0rath earned 250 total points
ID: 9691921
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
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10698218
sure it can.

putchar(c,PRN);

where c is the character to print.
PRN is defined as the printer port
0
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10698225
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
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10698232
sorry,replace putchar with fputc.
0
 
LVL 5

Expert Comment

by:g0rath
ID: 10704514
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

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question