DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Parallel Port Problems

  1. #1
    Join Date
    Nov 2008

    Parallel Port Problems


    I have written the following program in MS Visual C++ running on windows XP. It is supposed to set all the data lines of my parallel port to "high" when password 2006 is entered, and "low" when 9999 is entered. I am using UserPort to get around the port access restrictions of XP. I have a multimeter hooked up to pins 2 and 18 on my computer, and I'm reading 4.2 volts no matter what I enter. Here is the code:

    #include "stdafx.h"
    #include "conio.h"
    #include "stdio.h"
    #include "string.h"
    #include "stdlib.h" 
    #include <iostream>
    using namespace std;
    int main ()
    int i;
    cout << "Please enter password: ";
    cin >> i;
    if (i == 2006) {
    cout << "\n Password accepted \n Unlocking door... \n";
    _outp(0x378, 255); 
    cout << " Door has been unlocked... \n \n \n";
    else if(i == 9999){
    cout << "   System shutting down... \n\n\n";
    _outp(0x378, 0); 
    else {
    cout << "Entry denied \n\n";
    }while (i != 6606);
    return 0;
    Is this code simply flawed, or is there some other issue here?



  2. #2
    Join Date
    Nov 2003
    This code is designed for POSIX systems, and XP somehow supports it as a non-native extension or API. Vista is more secure and doesn't allow you to access hardware ports like this. You need to use a special library for that which essentially wraps low level hardware access with a higher level API (which is more secure and restricted).
    Danny Kalev

Similar Threads

  1. Replies: 8
    Last Post: 04-09-2007, 10:40 AM
  2. Replies: 2
    Last Post: 01-16-2006, 04:34 PM
  3. Replies: 3
    Last Post: 09-07-2002, 04:04 AM
  4. Data Reading from Parallel Port
    By Arunkumar in forum VB Classic
    Replies: 1
    Last Post: 04-29-2002, 01:23 PM
  5. Transferof String to the parallel port
    By Ali AZfar in forum VB Classic
    Replies: 4
    Last Post: 04-25-2002, 04:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center