Mail Archives: djgpp/2000/04/14/18:44:01
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 -