🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #7194

Re: TC++ & DeskJet+ graphics programming: can't print '\x1a' !!??

#7194
From: Frank van der Hulst
Date: Sun, 23 Jun 1991 01:56
47 lines
2480 bytes
>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.
Technical Details
Message-ID: <1991Jun23.015648.7597@cavebbs.gen.nz>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!comp.vuw.ac.nz!cavebbs!frank
References: <1991Jun21.040657.3195@ux1.cso.uiuc.edu> <1991Jun22.080947.504@cavebbs.gen.nz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!comp.vuw.ac.nz!cavebbs!frank
From: frank@cavebbs.gen.nz (Frank van der Hulst)
Newsgroups: comp.os.msdos.programmer,comp.lang.c,comp.sys.ibm.pc
Subject: Re: TC++ & DeskJet+ graphics programming: can't print '\x1a' !!??
Keywords: deskjet, tc++, c, c++
Message-ID: <1991Jun23.015648.7597@cavebbs.gen.nz>
Date: 23 Jun 91 01:56:48 GMT
References: <1991Jun21.040657.3195@ux1.cso.uiuc.edu> <1991Jun22.080947.504@cavebbs.gen.nz>
Organization: The Cave MegaBBS, Public Access Usenet, Wellington, NZ
Lines: 47