I try to make a very simple program with c language in Linux to set all data bit in parallel port
//thefile.c
#include<stdio.h>
#include<unistd.h>
#include<asm/io.h>
#define BASEPORT 0x378
int main(){
int i;
if (ioperm(BASEPORT,3,1)) {perror("ioperm");exit(1);}
outb(0xFF,BASEPORT);
usleep(100000);
i=inb(BASEPORT);
printf("%d\n",i);
if(ioperm(BASEPORT,3,0)) {perror("ioperm");exit(1);}
exit(0);
}
i compile the program using 'gcc thefile.c -o thefile'. after the owner and the file mode changed, I make a php script
<?
passthru("/var/www/html/./thefile");
?>
the browser display value of 255, as a result. But how to insert 255 into a variable ?