byu@csri.toronto.edu (Benjamin Yu) (08/10/88)
Many thanks to those of you who responded to my plea in finding
a solution to send hex 1a to stdprn. However, most of the suggestions
was to either open stdprn as binary mode or 'setmode' the file
handler of stdprn as binary. This is incorrect since stdprn is opened
in binary mode by default anyways. The correct solution was given by
Greg Greaves who indicated it was not Microsoft C that was the culprit
but something else (I forgot what already, but I think it was the
device driver) was eating the hex 1a away. Greg provided me a low
level routine to set stdprn in 'raw' mode and for those who are interested
here it is:
#include <dos.h>
void set_binary();
{
union REGS inregs, outregs;
inregs.h.ah = 0x44; /* dos function 44 */
inregs.h.al = 0x00; /* subfunction # 0 */
inregs.x.bx = 0x04; /* file handle (stdprn) */
int86( 0x21, &inregs, &outregs ); /* call interrupt 21 */
/* this will get the current */
/* device status in DX */
/* Now load registers to set */
/* device */
inregs.h.al = 0x01; /* subfunction # 1 */
inregs.h.dh = 0x00; /* make sure this is 0 */
inregs.h.dl = ( outregs.h.dl | 0xA0 );/* set to ignore the ctrl-chars */
int86( 0x21, &inregs, &outregs ); /* now call interrupt again to */
/* set device */
return;
}
Benjamin Yu
University of Toronto CSNET, UUCP, BITNET:
Department of Computer Science byu@csri.toronto.edu
Toronto, Ontario Canada M5S 1A4 {uunet,watmath}!csri.utoronto.edu!byu
(o) (416) 978 - 4299 (h) (416) 470 - 8206