Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpfcso!hpfinote!pnl From: pnl@hpfinote.HP.COM (Peter Lim) Newsgroups: comp.sys.ibm.pc Subject: Re: HELP! MS-DOS interception of data to PRN Message-ID: <19450050@hpfinote.HP.COM> Date: 7 May 90 18:12:03 GMT References: <1990May4.054639.19766@laguna.ccsf.caltech.edu> Organization: Hewlett Packard CICD Lines: 39 > I have a graphical application that sends data to the printer. The problem > is that there are character code 0x1A in the stream of data going to the > PRN. Unfortunately, it seems MS-DOS loves to intercept the 0x1A (which > is a control-Z, otherwise known as the end-of-file code) and refuse to send > any more data until it encounters some other character (like a carriage > return or a line) that it likes. In the meanwhile, it drops out a few bytes > of data in between. > > Does anyone have a solution to this that does NOT require the use of bios > printing services? In particular, the program is in C, and I'd like to keep > the portability as much as possible in the source. If I have to run a > little patch program to modify MS-DOS itself, though, I won't mind. > What you mean is not very clear. Does you C program write directly to the printer ? Or does it produce a file which you later dump to the printer from DOS ? Assuming you have access to the source code, when you open the device for write, use mode "wb" instead of just "w" (as you would under UNIX). This means binary mode and usually means don't add a carriage-return when you send a line-feed. I don't know if it do something to the Ctrl-Z stuff. But is definitely needed. Then, if you're copying the output file to the printer from DOS, try using COPY FILE PRN: /B for binary mode copy and so Ctrl-Z will not act as EOF mark. In any case, do not use the PRINT command from DOS which only handles text file. Hope that helps. Regards, ## Life is fast enough as it is ........ Peter Lim. ## .... DON'T PUSH IT !! >>>-------, ########################################### : E-mail: plim@hpsgwg.HP.COM Snail-mail: Hewlett Packard Singapore, : Tel: (065)-279-2289 (ICDS, ICS) | Telnet: 520-2289 1150 Depot Road, __\@/__ ... also at: pnl@hpfipnl.HP.COM Singapore 0410. SPLAT !