#include <stdio.h>
#include <conio.h>
#include <dos.h>

#define data 0x0378             /* LPT port address */

void main (void)
{
        int control = 0;
        int in = 0;
        clrscr ();
        control = (0xff);                       /*this sets all pins to a high */
        outport (data,control);             /* '' */
        control = (0x20);                    /*This sets the TYPE of port*/
        outport ( 0x378 + 0x402, control );         /*to a BI-directional port*/
        control = (0x20);                   /*this sets the data direction to input*/
        outport (data + 2,control);     /* '' '' '' */

        while (1)
        {
                in = inport (data);         /* read the data port */
                in &= (0xff);                /* mask out the 8 bits*/
                gotoxy (25, 12);          /* position on the screen */
                printf ("The data on the port is %x",in);         /*print it on the screen*/
        }
}