[PARPORT] Using C to program printer port

From: Jim Earl (jimearl@attbi.com)
Date: Sun Jan 26 2003 - 16:29:54 EST

  • Next message: Clemens Kirchgatterer: "Re: [PARPORT] Using C to program printer port"

    Hi all;

    I'm a newbie to this, so I hope I don't sound too silly.

    I'm trying to write a program in C that will let me turn on/off the data
    lines on the printer port so I can drive external transistors/relays.

    I've done this using Qbasic, but I can't get it to work in C. My
    application must run it as an executable under Linux.

    I've tried both the built-in compilers in SuSE linux (cc & gcc), and they
    give me an error with the following code:

    #include <stdio.h>
    #define DATA 0x0378
    #define STATUS DATA+1
    #define CONTROL DATA+2

    main()
    {

        int val1;

        val1 = 0x81; /* 1000 0001 */

        outportb(DATA, val1);

        exit(0);
    }

    "undefined reference to 'outportb'"

    I assume this is because there is no function called "outportb()". This was
    a "standard" function back in my days of Borland Turbo C...

    Can anyone help?

    --Jim

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Sun Jan 26 2003 - 16:48:01 EST