www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/03/03:27:51

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Output to the Printer
Date: 3 Mar 1997 06:01:35 GMT
Organization: The National Capital FreeNet
Lines: 44
Message-ID: <5fdpfv$nsc@freenet-news.carleton.ca>
References: <331A1B3B DOT 34DE AT arn DOT net>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet2.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Anthony Villena (skylight AT arn DOT net) writes:
> Hi!
> 
> I'm fairly new with C, and have decided to make DJGPP the compiler
> of my choice. Unfortunatly I haven't found any thing in the docs
> that tell me how to send text to the printer. If you could help it
> would be MUCH apperciated. Thanks!

In regular C:


/* printtst.c
   Shows how to send a simple text message to the printer.
   Anything you can do with printf can be done on the printer too.
   Graphics? That's a topic for another day :-)
*/

#include <stdio.h>

void main (void) {     /* For simplicity. Might cause warnings with -Wall */
  FILE *printer;       /* Pointer to file structure for the printer */
  printer=fopen("PRN:","w");    /* Open printer for writing, set up file
                                   structure. */
  fprintf (printer,"Hello, World!");
  fclose(printer);     /* Clean up printer, and ensure last line sent to
                          it is printed. */
}


In C++:

I haven't a clue, but there might well be a printer stream like the
monitor stream "cout" using libiostr.



Also, there might be a "stdprn" in stdio.h. I can't recall.

--
    .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
 -()  <  When I go to the theater, I always go straight to the "bag and mix"
    `*'  bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh

- Raw text -


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