Mail Archives: djgpp/1997/03/05/06:47:58
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 -