WriteConsole (kernel32)
Last changed: -93.170.246.50

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern bool WriteConsole(IntPtr hConsoleOutput, string lpBuffer,
   uint nNumberOfCharsToWrite, out uint lpNumberOfCharsWritten,
   IntPtr lpReserved);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

public static IntPtr GetStdOut ()

{

  const int STD_OUTPUT_HANDLE = -11;
  IntPtr iStdOut = GetStdHandle( STD_OUTPUT_HANDLE );
  return iStdOut;

}

public static short WriteConsoleLine ( string sLine )

{

  short cchWritten;
  if ( ! WriteConsole( GetStdOut(),
               sLine,
               (short) sLine.Length,
               out cchWritten,
               (IntPtr) 0 ) )
    return -1;
  return cchWritten;

}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation