#include <stdio.h>
#include <conio.h>
int main(void)
unsigned port = 0;
int value;
value = outp(port, 'C');
printf("Value %c sent to port number %d\n", value, port);
return 0;

It gives error
8 C:\Dev-Cpp\Abc\... `outp' undeclared (first use this function)

How to solve this ??
I write function in conio.h but it can't work...
Any one know correct function to declare outp in conio.h??
Plz help me...Thanks in advance

Recommended Answers

All 7 Replies

outp won't work in windows XP. You need inpout32.dll and then the _inp() and _out() functions.

More about this and download here

Or, since you're using a 32-bit compiler on a 32-bit OS, how about using the API which your OS provides for accessing whatever device it is you're interested in.

since no one has come out and said it, i guess i will:

you should avoid using OS-specific libraries such as <conio.h>. this only works with (some) MSFT Windows systems.

your code will never be portable using such libraries.

but, if you dont care, then i guess i dont either.

_CRTIMP int __cdecl_outp(unsigned portid, int value);

i m added this function in conio.h and also inpout32.dll in system32 but it not working...

Editing someone elses header files is ALWAYS a bad idea unless you really do know what you're doing.

How about you describe the problem you're trying to solve, rather than trying to make your broken approach work.

maybe he wants to take already non-portable code and render it completely unusable?

maybe he wants to take already non-portable code and render it completely unusable?

No disrespect intended. May be good point. But there are times when portable code will not work. Like when trying to deal with old hardware and some non standard legacy application. I got to this link when researching to program floppy controler at lowest level possible to read and write disk with old Japaneese 1.2m 3.5" format.

Be a part of the DaniWeb community

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