DPRG List  

[DPRG] Changing Printer Ports in C++

Subject: [DPRG] Changing Printer Ports in C++
From: Dave Hylands dhylands at broadcom.com
Date: Sun Aug 31 16:17:01 CDT 2003

Hi Dale,

You can't write directly to non memory mapped I/O ports in "normal" C or
C++. You need a helper routine written in assembler.

Most run time libraries provide routines named something like inport()
and outport() which do the work for you. Sometimes they'll be called
_inport _outport or _inp and _outp.

In Visual C++ 6.0 they're called _inp and _outp and they can be found in

Microsoft Documentation for these can be found here:

(try http://tinyurl.com/lss0 if the above wraps)

Dave Hylands
Vancouver, BC, Canada

> -----Original Message-----
> From: Dale Wheat [mailto:dale at dalewheat.com] 
> Sent: Sunday, August 31, 2003 9:30 AM
> To: daweasel at swbell.net; DPRG
> Subject: Re: [DPRG] Changing Printer Ports in C++
> Bill,
> > You still haven't answered my question though -- how can I directly 
> > write to LPT2 in C++? One reference book mentioned using a file 
> > pointer and the FOPEN statement, but it did not seem to 
> work properly 
> > for either port, although an FPRINTF to STDPRN worked fine.
> Sorry, I have no idea how you'd do that in C++.  Any 
> low-level C++ gurus lurking out there?
> The only possible thing I could think of would be to open 
> another file for LPT2 and then overwrite stdprn with the new 
> file handle.  I don't even know if that would work.
> Thanks,
> Dale Wheat
> http://dalewheat.com
> (972) 486-1317
> (800) 330-1915, access code 00
> _______________________________________________
> DPRGlist mailing list
> DPRGlist at dprg.org http://nimon.ncc.com/mailman/listinfo/dprglist

More information about the DPRG mailing list