Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cuae2!gatech!lll-lcc!pyramid!voder!kontron!cramer From: cramer@kontron.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: Need help with MS-DOS 3.1 and COM1 device Message-ID: <1342@kontron.UUCP> Date: Thu, 29-Jan-87 12:30:28 EST Article-I.D.: kontron.1342 Posted: Thu Jan 29 12:30:28 1987 Date-Received: Sat, 31-Jan-87 02:11:18 EST References: <3281@hplabs.hplabs.UUCP> Organization: Kontron Electronics, Mt. View, CA Lines: 49 > I have written a DVI to HP LaserJet+ Driver that runs under both Unix > and MS/PC-DOS. Unfortunately, I have discovered a problem either in the > Aztec C Run-time support, (which they deny), or a problem with MS-DOS, > (a misunderstanding, no doubt). I am running MS-DOS V3.1 and am > putc()ing characters to a stream that was successfully opened via > fopen() for "w" access to "COM1". I check the returned pointer for NULL > and guaranteed fopen()s success. However, after writing BUFSIZ > characters, putc() returns EOF. I traced the run-time code and found > that a DOS write handle was returning less bytes than were written. The > Manx code gave up the ghost and died. I rewrote the routine to loop > through write() calls until the entire buffer had been written. When I > compiled and ran the code, MS-DOS continually and repeatedly refused to > accept any more data to the fopen()ed handle. > > Next, instead of directing output to COM1 I started sending the data to > the disk file "laserjet.dat" and was pleased to find that the data was > indeed there and correct. I then copied the file to COM1 via the > command: > > COPY LASERJET.DAT COM1 > > and was disturbed to find that the file did not print on the LaserJet. > After reading the DOS manual I discovered that the /B option for COPY > would probably correct the problem. I used it and it did! OK, the > question is, "WHAT MS-DOS FUNCTION CALL DID COPY MAKE TO CAUSE THE FILE > TO PRINT?" It sounds like the handle must be placed in raw mode, or > something synonymous. Unfortunately, I do not know how to do this, and > the programmer's manual for MS-DOS is not too helpful. Any help would > be appreciated. Writing to a temporary file and then system()ing COPY > is not an acceptable solution. Many thanks in advance. > > Dave Richards at Hewlett-Packard Labs (drichard@hplabs) Assume the Aztec library is bad. I have programs that write to an Apple LaserWriter using COM1 from Microsoft C using fopen and printf and the only problem I have is that the LaserWriter starts losing data eventually because PC-DOS doesn't support XON/XOFF. My experiences with Aztec C libraries have been pretty disheartening. I wrote a small program a couple of years ago using the Aztec C compiler to read characters from the keyboard. There are a number of characters on the IBM keyboard that return two characters -- a NULL and then a second character. The Aztec compiler returned just the second byte, with no indication that a NULL should be there also. As a result, I was unable to distinguish arrow keys from some of the letters. That's when I went out and bought Microsoft C. Clayton E. Cramer