I have attached my code. To run the code I am compiling it, gcc parallel.c -o parallel, chown root parallel, and chmod u+s parallel which allows ioperm() to return a positive value not -1.
To test what values I am getting on the parallel port, I have attached LED's which activate when the port goes high (5v). I also tested them with a multimeter. But the LED's are the easiest to see what value the port has. While trying to change the values with the program nothing happened to the LED's they just stayed the same, first 5 on last 3 off.
/* paralell port test bed */
#define basePort 0x378 //port number
printf("Parallel Port Interface\n");
/* Allow access to the ports - Start port - Number of ports - 1=on 0=off */
ioperm(basePort, 1, 1);
printf("Enter value 0-255: ");
scanf("%d" , &byte);
while ( byte >= 0 )
printf("value: %d\n", inb(basePort));
printf("Enter value 0-255:(>0 exit) ");