We recommend using Visual Studio 2017

_inp, _inpw, _inpd


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _inp, _inpw, _inpd.

Inputs, from a port, a byte (_inp), a word (_inpw), or a double word (_inpd).

System_CAPS_ICON_important.jpg Important

These functions are obsolete. Beginning in Visual Studio 2015, they are not available in the CRT.

System_CAPS_ICON_important.jpg Important

This API cannot be used in applications that execute in the Windows Runtime. For more information, see CRT functions not supported with /ZW.

int _inp(   
   unsigned short port   
unsigned short _inpw(   
   unsigned short port   
unsigned long _inpd(   
   unsigned short port   


I/O port number.

The functions return the byte, word, or double word read from port. There is no error return.

The _inp, _inpw, and _inpd functions read a byte, a word, and a double word, respectively, from the specified input port. The input value can be any unsigned short integer in the range 0 – 65,535.

Because these functions read directly from an I/O port, they might not be used in user code in Windows NT, Windows 2000, Windows XP, and Windows Server 2003.

RoutineRequired header

For more compatibility information, see Compatibility.

All versions of the C run-time libraries.

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

Console and Port I/O
_outp, _outpw, _outpd