WriteConsoleA
WriteConsoleA is a Windows API function in Kernel32.dll that writes a sequence of ANSI characters to a console screen buffer. It is the ANSI (8-bit) variant of the console writing functions, with WriteConsoleW providing the wide-character version. This function is commonly used with console handles obtained from GetStdHandle or other console creation APIs.
BOOL WriteConsoleA(HANDLE hConsoleOutput, const void* lpBuffer, DWORD nCharsToWrite, LPDWORD lpCharsWritten, LPVOID lpReserved);
- hConsoleOutput: a handle to the console screen buffer or the console's standard output.
- lpBuffer: a pointer to a buffer containing the characters to write.
- nCharsToWrite: the number of characters to write from the buffer.
- lpCharsWritten: receives the number of characters actually written.
- Zero indicates failure; extended error information can be obtained with GetLastError.
- The input bytes are interpreted according to the current ANSI code page, and may be translated
- If the console cannot accommodate all requested characters, the function writes as many as will fit
- The function requires a console output handle; if the handle is not connected to a console,
- For Unicode applications, WriteConsoleW is generally preferred to avoid code page translation concerns.
- The lpReserved parameter must be NULL.
See also: WriteConsoleW, WriteConsoleOutputA, GetStdHandle, STD_OUTPUT_HANDLE, GetLastError.