input from parallel port

Hello! can anyone tell me what's wrong with my code?  It's supposed to get input from my parallel port.  I compiled it with turbo c++.  I'm using windows me.

#include <dos.h>
#include <iostream.h>

main()
{
for( unsigned int i = 0; i < 256; i++ )
  {
  int x = inportb( 0x379 );
  cout<<x<<" ****"<<'\n';
  sleep( 1 );
  }
}

the output i get is:

120 ****
120 ****
... and so on...

this happens even though I put one of the input pins into high logic( 5V ).  Can anyone tell me what's wrong?  thanks!
wirgeld23Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MafaldaCommented:
LPT1 data is at 0x378 ....
0
wirgeld23Author Commented:
i thought 0x378(data port) was for output and 0x379(status port) was for input?...(0x37A for control port)
0
MafaldaCommented:
Yes, the status ports are designed for input...
Are you sure that you are accesing the active parallel port.
In some PCs 0x378 is LPT2, 0x278 is LPT3 ... and 0x3BC is LPT1
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

MafaldaCommented:
Also, a good book for you:
http://www.lvr.com/parprtib.htm
0
wirgeld23Author Commented:
i checked my parallel port address.  The i/o is in 378.  Does that mean I should use 378 even when inputting data?  By the way, what am I supposed to get when I use the inp function if I don't input anything?  and if I do input 5v in one of the input pins?
0
wirgeld23Author Commented:
ps.  my parallel port is set to EPP.  I read that you can input to pins 2-8( data pins ) in EPP.  I tried it but nothing happens.
0
Mayank SAssociate Director - Product EngineeringCommented:
I see that you've also posted the question under the 'Programming' section.

Please refer to:

http://www.experts-exchange.com/Programming/Q_20566532.html

where more comments have been posted for you.

Mayank.
0
tinchosCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Tinchos
EE Cleanup Volunteer
0
Computer101Commented:
PAQed, with points refunded (20)

Computer101
E-E Admin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.