Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

test lpt port

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Im a beginner in c++ and i can set this code to work:

#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(&quot;No port found for LPT%d \n&quot;,a+1);
else
printf(&quot;Address assigned to LPT%d is %Xh\n&quot;,a+1,address);
*ptraddr++;
}
}

a)is this code compatible with microsoft c
b)i make a new project console win32 application and i put this source in a .cpp file and *.*.h files in the header directory. what else do i have to do everytime it writes me that it can not recognise the &quot;far&quot; thing that is mentioned in the source above.
 
Try not to use &quot;far&quot; at all. I think, there are no more memory modells and all pointers are &quot;far&quot; in 32 bit environment. Aren't?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top