In C++ you can write/read data in/from ports (including serial an parallel ports) using the _outp /_inp commands respectively.
The PC parallel port has two input ports and one output port :
DATA PORT ,output; in the address of 0x378
STATUS PORT ,input; in the address of 0x379
CONTROL PORT ,output; in the address of 0x37a
The syntax for the _outp command is as follows :
Code:
int _outp(unsigned short PORT_ADDRESS , int data)
instead of using the hex addresses ,you can define constant names for each port :
Code:
const int DATA_PORT=0x378;
const int STATUS_PORT=0x379;
const int CONTROL_PORT=0x37a;
here is an example of how to write/read data in/from ports :
inp and outp haven't worked since Win98. You have
to use IO .dlls that allow access to ports in Win2K and XP by messing with the IO privilege map (or whatever it's called) and using a couple of undocumented low level routines in the WinAPI ). In fact I think the last one I used was called IO.DLL. Anyway, there are several out there.