www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/20/05:27:47

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How do I print using 'fprintf()' to LPT1?
Date: Wed, 19 Feb 1997 20:36:45 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 31
Message-ID: <330BD4DD.552C@cs.com>
References: <5efjvt$4tj AT news DOT interlog DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp220.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Gautam N. Lad wrote:
> 
> Hi,
> Can someone tell me how to print using fprintf()?
> Basically, I want to print to LPT1.  I know this is possible!

ANSI C defines an output file called 'stdprn' which is always open and
allows you to write to the printer.  So, you'd just use something like
the following:

fprintf( stdprn, "This is going to the printer.\n" );

If you have a line or dot-matrix printer, then you'll see the line of
text immediately as you send it (or rather, as soon as you send a
newline).  If you have a laser, bubblejet, or inkjet printer, it buffers
the data until it gets a full page, so you'll need to send a form feed
('\f') in order to get a printout.

Hope this helps!

-- 
John M. Aldrich <fighteer AT cs DOT com>                      

* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
  causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
  again.
* It doesn't necessarily do it in chronological order, though.
 
                                       --- Douglas Adams

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019