Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inp and outp troubles

Status
Not open for further replies.

EvilCabal

Programmer
Jul 11, 2002
206
CA
Hello,

I'm trying to control the parallel port via the functions inp and outp. First it did not compile at all, then I added an underscore to the function calls (i.e. _inp and _outp), now it compile but the program crashes! woohoo! Please help ;P

Here is the code, I'm using winXP and VC 6.0 w/ SP5 :

#include <dos.h>
#include &quot;bios.h&quot;
#include <stdio.h>
#include <conio.h>


#define BASE_ADDRESS 0x0378 // printer port base address
#define DATA_REGISTER (BASE_ADDRESS+0) // address of data register
#define STATUS_REGISTER (BASE_ADDRESS+1) // address of status register
#define CONTROL_REGISTER (BASE_ADDRESS+2) // address of control register

int main(void)
{

char my_byte = 0;
char Status;

/* Either of these 2 lines crash the program */
Status = _inp(STATUS_REGISTER);
_outp(DATA_REGISTER,my_byte);

return 0;

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top