Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ukma!gatech!hubcap!ncrcae!ncrlnk!uunet!mcvax!enea!kth!draken!tut!santra!tukki!mat65
From: mat65@tukki.jyu.fi
Newsgroups: comp.sys.ibm.pc
Subject: Printer blues
Summary: write to printer doesn't send ^Z's
Keywords: printers binary
Message-ID: <17693@santra.UUCP>
Date: 29 Nov 88 06:10:17 GMT
Sender: news@santra.UUCP
Reply-To: makela_otto_@jylk.jyu.fi
Organization: University of Jyvaskyla, Finland
Lines: 37

This came up when I was making a program to view MacPaint pictures on a PC
and to print them onto a printer.  The program is written in C, and it uses
the standard write() call to get stuff to the printer.  I open the file by
name (ie. open("/dev/prn",...)) rather than use the ready file descriptors
for printers so that the print output can easily be swiped to a disk file.

The picture is sent to a laser printer by sending an escape sequence giving
the binary picture size and the picture width in bytes, followed by the
picture data, in binary.

The problem came up when I mistakenly printed a picture on the Canon LBP-8
I use in inverted mode.  Everything worked OK, except that the picture was
(of course) mostly black.  Then, I inverted the picture and tried to reprint
it.  It didn't print out.  Mystified by this, I pressed the manual-print
button on the laser printer.  Out comes a page with the picture partially
correct and partially garbled.

After lots of debugging and guesswork, I came to the conclusion that the
standard MS-DOS write interface DOES NOT ALLOW ^Z CHARACTERS TO GO OUT TO
THE PRINTER.  To a file, yes.  It's not the C library, I have sources for
that and there are no special-case tests for ^Z's to a printer file...
Neither is it the Centronics-printer interface, since my screen dumps often
contain ^Z's and they get printed ok on the laser.

This came up on a Unisys 500 (PC/AT MS-DOS 3.30), but also on a non-pc-clone
running MS-DOS 2.11 and a genuine IBM PC/AT under PC-DOS 3.20...

Has anybody else seen behaviour like this ?
Does anyone have an idea WHY this type of censorship has been implemented
(hello folks at MicroSoft, are u listening) ?

Otto J. Makela (with poetic license to kill), University of Jyvaskyla

InterNet: makela_otto_@jylk.jyu.fi, BitNet: MAKELA_OTTO_@FINJYU.BITNET
BBS: +358 41 211 562 (V.22bis/V.22/V.21, 24h/d)
Voice phone: +358 41 613 847
Mail: Kauppakatu 1 B 18, SF-40100 Jyvaskyla, Finland, EUROPE