DPRG
DPRG List  



[DPRG] Changing Printer Ports in C++

Subject: [DPRG] Changing Printer Ports in C++
From: rten at new.metronet.com rten at new.metronet.com
Date: Mon Sep 1 11:11:00 CDT 2003

This illustrates why I have been defeated every time I even look at C.
Ralph

On Sun, 31 Aug 2003, Dave Hylands wrote:

> 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
> conio.h
>
> Microsoft Documentation for these can be found here:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/h
> tml/_crt__inp.2c_._inpw.2c_._inpd.asp
>
> (try http://tinyurl.com/lss0 if the above wraps)
>
> --
> Dave Hylands
> Vancouver, BC, Canada
> http://www.DaveHylands.com/
>
> > -----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
> >
> >
>
> _______________________________________________
> DPRGlist mailing list
> DPRGlist at dprg.org
> http://nimon.ncc.com/mailman/listinfo/dprglist
>


More information about the DPRG mailing list