Printer Ports...

This is a discussion on Printer Ports... within the C Programming forums, part of the General Programming Boards category; Can ANYONE please tell me how to write code which determines which printer port is the actual port? I have ...

  1. #1
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77

    Printer Ports...

    Can ANYONE please tell me how to write code which determines which printer port is the actual port? I have read every message on here about the ports and all of the links....but I still can't get my code to work...

    Code:
    #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 a;
    
     ptraddr=(unsigned int far *)0x00000408;
    
     for (a = 0; a < 3; a++)
       {
        address = *ptraddr;
        if (address == 0)
    		printf("No port found for LPT%d \n",a+1);
        else
    		printf("Address assigned to LPT%d is %Xh\n",a+1,address);
        *ptraddr++;
       }
    }
    I got that code from a website...but it won't work either..Visual C++ says "Far" is an obsolete keyword...and Borland just won't compile it...anyone?

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    35
    Ok, i cannot answer your question about the printer port, but i can help about the compilers not compiling that code. You need a 16-bit dos compiler, FAR pointers are obsolete in a 32-bit enviroment so get something like Borland Turbo C++ 3.1, it does compile code with FAR pointers and much more.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Set Printer Prior To Loading Print Dialog Box
    By Beaner in forum Windows Programming
    Replies: 3
    Last Post: 10-10-2008, 01:02 PM
  2. changing property (layout) of a printer
    By leojose in forum Windows Programming
    Replies: 5
    Last Post: 12-05-2005, 06:16 AM
  3. virtual ports
    By royuco77 in forum Networking/Device Communication
    Replies: 5
    Last Post: 07-02-2005, 10:33 AM
  4. Success - Output to Printer
    By noraa in forum C Programming
    Replies: 5
    Last Post: 08-04-2002, 09:12 AM
  5. Replies: 0
    Last Post: 04-30-2002, 07:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21