Path: utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!rutgers!ucsd!helios.ee.lbl.gov!nosc!cod!bmarsh From: bmarsh@cod.NOSC.MIL (William C. Marsh) Newsgroups: comp.sys.ibm.pc Subject: Re: Laserjet font downloading problem Keywords: laserjet, download Message-ID: <1701@cod.NOSC.MIL> Date: 17 Nov 89 23:27:49 GMT References: <1624@shuksan.UUCP> <3148@convex.UUCP> Reply-To: bmarsh@cod.nosc.mil.UUCP (William C. Marsh) Organization: Naval Ocean Systems Center, San Diego Lines: 51 In article <3148@convex.UUCP> harper@convex.COM (David Harper) writes: >In article <1624@shuksan.UUCP> mikey@shuksan.UUCP (Mike Fields) writes: >>I am having a problem talking to a laserjet on the parallel port. I >> *rest of problem description deleted* > >For what it's worth, you are not alone. I had the exact same problem >and tried basically everything you have tried so far. I never did >solve the problem. I finally ended up with a kludge way around the The problem is the difference between opening a file and a device under DOS. (I'm not talking about the open() C call here, but the DOS interrupt). DOS files are opened in 'RAW' mode, while devices are opened in 'TEXT' mode. You need to use the function 44h (IOCTL) to change the 'mode' to RAW mode to output binary data to devices. (Note: This also speeds up console output, since DOS won't look for ^S, ^C, ^P, etc.). A simple example (in Microsoft 'C'): #include #include int fd; union REGS in, out; unsigned char old_mode; fd = open("prn", O_WRONLY | O_BINARY); /* O_BINARY needed for C library */ in.x.bx = fd; in.x.ax = 0x4400; /* read device mode */ intdos(&in, &out); in.x.ax = 0x4401; /* set device mode */ old_mode = out.h.dl; /* save old mode for later */ in.h.dl = out.h.dl | 0x20; /* turn on RAW bit */ in.h.dh = 0; /* Important! */ intdos(&in, &out); /* do your stuff here */ in.x.ax = 0x4401; /* set mode again */ in.x.bx = fd; in.h.dl = old_mode; intdos(&in, &out); /* reset to old mode */ Hope this helps! Bill Marsh, Naval Ocean Systems Center, San Diego, CA {arpa,mil}net: bmarsh@cod.nosc.mil uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!nosc!bmarsh "If everything seems to be coming your way, you're probably in the wrong lane."