Monday 18 July 2011

PROGRAM TO OBTAIN ADDRESSES OF PRINTER PORTS

//PROGRAM TO OBTAIN ADDRESSES OF PRINTER PORTS 
#include <stdio.h>
#include <dos.h>

void main(void)
{
      unsigned int far *ptraddr;  /* Pointer to location of Port Addresses */
      unsigned int address;  /* Address of Port */
      int i;

      ptraddr=(unsigned int far *)0x00000408;

      for (i = 0; i < 3; i++)
      {
               address = *ptraddr;
               if (address == 0)
               printf ("No port found for LPT%d \n", i+1);
               else
               printf("Address assigned to LPT%d is %Xh\n", i+1,address);
              *ptraddr++;
       }
}

Note :Execute this code on your own risk.

No comments:

Post a Comment

Get CSV Values in SQL

Query: DECLARE @CSVValue NVARCHAR(50)='100,101,102'                   DECLARE @eachValue NUMERIC(9,0)   while len(@CSVValue) &...