Name
outp, outpw - Write to a specified output port.
Syntax
#include <conio.h>
int outp(port, byte)
unsigned outpw(port, word)
unsigned port;
int byte;
unsigned word;
Description
The outp and outpw functions write a byte and a word,
respectively, to the specified output port. The port
argument can be any unsigned integer in the range 0 -
65,535; byte can be any integer in the range 0 - 255; and
word can be any value in the range 0 - 65,535.
Both outp and outpw are supported in the OS/2 compatibility
box. If you use these functions, you must also use a .DEF
file to declare the IOSEG segment the run-time library uses
to perform input/output on the port. In addition, the
intrinsic (/Oi) versions of these functions do not work
unless you put the code in a segment that is marked with the
IOPL keyword in the
Return Value
The functions return the data output. There is no error
return.
See Also
inp(DOS), inpw(DOS)
Example
#include <conio.h> #include <stdio.h>
int port, byte_val;
main()
{
port = 1;
byte_val = 3;
outp(port,byte_val);
printf("The value %d has been output to port %d",
byte_val, port);
}
This program uses outp to write the value 3 to output port
1.
(printed 6/18/89)