Date: Wed, 28 Mar 2001 11:35:40 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp AT delorie DOT com Subject: Re: lpt: and prn: devices In-Reply-To: <99r4ga$29l$1@plutonium.btinternet.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Tue, 27 Mar 2001, BT wrote: > I am writing an emulator, and now have discovered that it would be the most > useful thing in the world to emulate the parallel port of that computer via > the PC's parallel port. Rather than mess about with port numbers and such > like though, I thought I might just use one of the DOS devices lpt: or prn:. > I don't know if these are properly implemented in DOS though, and suspect > like many other things they may be highly dependant on the code that uses > them doing most of the work, hence my post here rather than somewhere else. > > So, my questions - assuming I open with fopen : First, the system parallel port is already open when your program starts: either use the stdprn stream, or write to file handle 4. If you do want to open, use "lpt1" and "prn", not "lpt1:" or "prn:". If you use the colons, the open will most probably fail, because the DOS device's name does not include the colon. ANd don't forget to open in binary mode! > is there any reinterpretation of bytes sent to these devices? e.g. if I have > an Epson FX and I send Epson FX escape codes, do my Epson FX escape codes > get all the way to my Epson FX? There's no interpretation, whatever you send gets to the printer verbatim, since the pre-connected stream is in binary mode. > are (either of) these devices supported in the 'DOS' boxes of NT and 2000? AFAIK, they are all supported on all versions of Windows, except that Windows can capture a port and redirect it to a networked printer. This is determined by the properties of the printer(s) installed on the particular machine.