TC++ & DeskJet+ graphics programming: can't print '\x1a' !!??
Frank van der Hulst
frank at cavebbs.gen.nz
Sun Jun 23 11:56:48 AEST 1991
>The problem lies with TC++ (and TC and Turbo-Pascal going back at least 5
Oops -- minor mistake. The problem relates to MS-DOS, going back several years.
>years). The stdprn stream is opened as text mode, not binary, so a \x1A acts
>as an EOF character (just like a disk text file). You need to re-open stdprn
>in binary mode. I have code (elsewhere) which does this by doing a DOS call
Doing open() or whatever from C won't work -- here's the code (in assembler),
although doing the same in C via intdos() should work fine.:
; bin_mode:
; int far bin_mode(int handle);
; Change device into binary mode.
; Assemble via TASM /mx BIN_MODE
; DOS always ignores the binary parameter ("b") on device opens - LPT1,
; etc. You have to follow the open with an IOCTL call to get the output
; device operating in binary mode. Note that it needs the result of an
; sopen(), open() or fdopen() call.
_bin_mode proc far handle: word
push bp
mov bp, sp
mov ax, 4400h ; Read device info
mov bx, handle ; file handle from open
int 21h ; Get device data into DX
jc exit ; Check whether valid
and dl, 80h ; Is this a file or device ?
jz exit_OK ; If file, do nothing
mov ax, 4401h ; Set device parms
mov bx, handle
xor dh, dh ; Clear high byte
or dl, 20h ; Ignore control characters, incl. ^Z
int 21h
jc exit
exit_OK:xor ax, ax
exit: pop bp
ret
>
--
Take a walk on the wild side, and I don't mean the Milford Track.
Kayaking: The art of appearing to want to go where your boat is taking you.
More information about the Comp.lang.c
mailing list