Search code examples
clinuxgccparallel-port

What is the outp() counterpart in gcc compiler?


In my School my project is to make a simple program that controls the LED lights

my professor said that outp() is in the conio.h, and I know that conio.h is not a standard one.

example of outp()

//assume that port to be used is 0x378
outp(0x378,1); //making the first LED light

thanks in advance


Solution

  • How to write to a parallel port depends on the OS, not the compiler. In Linux, you'd open the appropriate device file for your parallel port, which is /dev/lp1 on PC hardware for port 0x0378.

    Then, interpreting the MS docs for _outp, I guess you want to write a single byte with the value 1 to the parallel port. That's just

    FILE *fp = fopen("/dev/lp1", "wb");
    // check for errors, including permission denied
    putc(1, fp);