bool result = ReadConsole(
GetWin32InputHandle(),
buffer,
256,
out charsRead,
(IntPtr)0
);
// Return the input minus the newline character
if(result && charsRead > 1) return buffer.ToString(0, (int)charsRead - 1);
return string.Empty;
}
Alternative Managed API:
Do you know one? Please contribute it!
The ReadConsole API
3/11/2010 4:11:53 PM - -69.116.57.30
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 11:00:13 AM - tsahi-62.219.227.88
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).