outport, outportb
raw OCR
Outputs a word or byte to a hardware port.
Defined in header <dos.h>
Syntax
#include <dos.h>
void outport(int portid, int value);
void outportb(int portid, unsigned char value);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
outport works just like the 80x86 instruction out. It writes the low byte of the word given by value to the output port specified by portid and writes the high byte of the word to portid +1.
outportb is a macro that writes the byte given by value to the output port specified by portid.
If outportb is called when dos.h has been included, it will be treated as a macro that expands to inline code. If you don't include dos.h, or if you do include dos.h and #undef the macro outportb, you'll get the outportb function.
Return value
None.
See also
Example
#include <stdio.h>
#include <dos.h>
int main(void)
{
int value = 64, port = 0;
unsigned char c_value = 'C;
outportb (port, value);
printf("Value %d sent to port number %d\n", value, port);
outportb(port, c_value);
printf("Character %c sent to port number %d\n", c_value, port);
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/dos.h/outport/
· short form /3.1/outport/