www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/14/18:44:01

From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: need info
Date: Fri, 14 Apr 2000 19:54:18 +0200
Organization: NetVision Israel
Lines: 34
Message-ID: <38F75B4A.32E4DF7E@is.elta.co.il>
References: <yzuJ4.2920$4W3 DOT 43382 AT typhoon DOT nyroc DOT rr DOT com> <8d779a$dsq$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <8d7lbn DOT 3vvqipv DOT 0 AT buerssner-17104 DOT user DOT cis DOT dfn DOT de>
NNTP-Posting-Host: ras1-p48.rvt.netvision.net.il
Mime-Version: 1.0
X-Trace: news.netvision.net.il 955731209 27540 62.0.172.50 (14 Apr 2000 16:53:29 GMT)
X-Complaints-To: abuse AT netvision DOT net DOT il
NNTP-Posting-Date: 14 Apr 2000 16:53:29 GMT
X-Mailer: Mozilla 4.7 [en] (Win98; I)
X-Accept-Language: en,ru,hebrew
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Dieter Buerssner wrote:
> 
> Hans-Bernhard Broeker wrote:
> 
> >Only 1) is really on-topic in this newsgroup, I think. The answer in a
> >nutshell could be as simple as 'write them to the stdprn stream'.
> 
> Or fopen the printer device in binary mode.

The predefined stream stdprn is already open in binary mode.  See the file
src/libc/dos/io/dosio.c in the library sources.

> Something like
> 
> #define PRINTER_DEVICE "prn:"
> 
> FILE *fpprn = fopen(PRINTER_DEVICE, "wb");

This won't work: the DOS device name is "PRN", without the colon.  (The colon
in the end might work from COMMAND.COM because it treats the colon as a
separator character and doesn't pass it to DOS.  But it won't work from a
program.)

> may be easier to port.

Why is it easier to port?  All DOS/Windows environments support stdprn
because the printer is always open on handle 4 when the program starts.

> Also, the availability of stdprn in DJGPP
> depends on compiler flags. (IIRC, it won't work with -ansi.)

Nope, stdprn is always available.  You can see in stdio.h that its
declaration is before the "#ifdef __STRICT_ANSI__" part, which begins the
part that's invisible to the compiler under -ansi.

- Raw text -


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