TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jim Hansen
from: George White
date: 1998-09-19 07:04:08
subject: Stdprn

Hi Jim,

You wrote to Robin Sheppard:

JH> JH> I have #include both stdio.h and stdlib.h.  This is the command I
JH> JH> used:
JH> JH> #include 
JH> JH> #include 


JH>RS>    You don't need to #include STDLIB.H here.  The only
JH>RS> library     function you're using is fprintf(), which is
JH>RS> prototyped in STDIO.H.      For the record, this is probably
JH>RS> the most commonly used header file     in C.  It doesn't
JH>RS> hurt to #include it, though.

JH> JH> for (count = 0; count < copies; count++)
JH>RS>
JH>RS>    You didn't declare count here, nor the in_data array (or
JH>RS> pointer).      Your code also doesn't have any function
JH>RS> header.  Everything after     the #include statements should
JH>RS> be part of a function- I'm assuming     you skipped this
JH>RS> because it's an excerpt, but starting off with the
JH>RS> #includes makes it look like it's s'posed to be a complete
JH>RS> program.

JH>Sorry for the impression this was the whole code, it wasn't.  For breavity
JH>sake I had just posted the relevant parts.  Next time I'll
JH>put in a [snip] to show that.

JH> JH> {
JH> JH> fprintf(stdprn, "%s\n", *in_data[0]);
JH> JH> fprintf(stdprn, "%s\n\n\n\n", *in_data[1]);
JH> JH> fprintf(stdprn, "\"%s\"", *in_data[2]);
JH> JH> }

JH> JH> Any ideas what the correct constant for redirecting to the printer is?

JH>RS>    I'm not trying to nit-pick your code, here.  It's just
JH>RS> that you     said you were new, and I don't know how new, so
JH>RS> I'm pointing out     the obvious.  Now on to your original
JH>RS> query.  :>

JH>Nitpick away!

JH>RS>    In the online help for my compiler, QuickC 2.5 for DOS,
JH>RS> it has the     following preopened streams:
JH>RS>      stdin  - standard input, defaults to keyboard
JH>RS>      stdout - standard output, defaults to screen
JH>RS>      stderr - standard error, defaults to screen
JH>RS>      stdaux - standard auxiliary, defaults to first serial
JH>RS> port      stdprn - standard printer, defaults to first
JH>RS> parallel port
JH>RS>    The latter two streams, stdaux and stdprn, are noted as
JH>RS> being DOS     only.  If you're using a DOS compiler, it
JH>RS> _should_ support these     streams, as far as I know, but if
JH>RS> you're not, there are no     guarantees.  There might be
JH>RS> some PD/shareware routines out there to     handle the
JH>RS> printer, though, and you'll no doubt be told (by all the
JH>RS> pros here) to check the latest SNIPPETS archive and look in
JH>RS> there     too.  This is a guess, because I'm not sure if
JH>RS> SNIPPETS has this-     being machine dependant, and all- but
JH>RS> it probably does.

JH>I'm using OS/2, so maybe that is the problem.

OS/2 only provides the first three standard streams pre-opened, that is
STDIN, STDOUT and STDERR.

You'll have to open the printer yourself. For OS/2 programming help join
us over in OS2PROG.

George

 * SLMR 2.1a * Computers eliminate spare time.

--- Maximus/2 3.01
* Origin: DoNoR/2,Woking UK (44-1483-717904) (2:440/4)
SEEN-BY: 396/1 622/419 632/0 371 633/260 267 270 371 634/397 635/506 728 810
SEEN-BY: 639/252 670/218
@PATH: 440/4 255/1 251/25 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.