I need to work out some parallel port output signals.

I found a short program to test bits on that port.
It tells I need to set the permission with ioperm() as this:

#include <asm/io.h>
#include <iostream>
#include <cstdlib>
#include <unistd.h>

#define base 0x378           /* printer port base address */
#define value 255            /* numeric value to send to printer port */

using namespace std;

main(int argc, char **argv)
   if (ioperm(base,1,1))
    fprintf(stderr, "Couldn't get the port at %x\n", base), exit(1);

   outb(value, base);

but when i try to compile it reports error:
`ioperm' undeclared (first use this function)

help pls.

Recommended Answers

All 4 Replies

What operating system are you using? That is a linux function and not supported in MS-Windows. But if you are using linux then I don't know the answer because I don't have a linux computer available to me where I am at.

I am using slackware linux 10.2.

Try replacing #include <asm/io.h> to #include <sys/io.h> and tell me what you get.

Great, no error

Now I check the real output on pins.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.