delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/05/06:47:58

Date: Wed, 5 Mar 1997 13:33:20 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Paul Derbyshire <ao950 AT FreeNet DOT Carleton DOT CA>
cc: djgpp AT delorie DOT com
Subject: Re: Output to the Printer
In-Reply-To: <5fj1fk$d8i@freenet-news.carleton.ca>
Message-ID: <Pine.SUN.3.91.970305133043.16313A-100000@is>
MIME-Version: 1.0

On 5 Mar 1997, Paul Derbyshire wrote:

> Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) writes:
> > On 3 Mar 1997, Paul Derbyshire wrote:
> > 
> >>   printer=fopen("PRN:","w");
> > 
> > Did you actually try this?  AFAIK, it should be "PRN", not "PRN:".
> 
> All my DOS manuals call the device PRN:. Same for all the COM, LPT, and CON.

You didn't tell if you tried it.  However, I just did, and it seems that
your manuals are wrong.  The little proggy below consistently fails to
open "PRN:", but if I change that to "PRN", it succeeds.  This is
consistent with what I know: the DOS device name is "PRN", not "PRN:". 

#include <stdio.h>
int main(void)
{
  FILE *fprn = fopen ("PRN:", "wb");

  if (fprn)
    fprintf (fprn, "Hello, world of printers!\n\f");
  else
    printf ("failed to open\n");
  return 0;
}

- Raw text -


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