WriteConsoleOutputCharacter

  BOOL WriteConsoleOutputCharacter(hConsoleOutput, lpszWrite, cchWrite, coordWriteCoord, lpcWritten)    
  HANDLE hConsoleOutput; /* identifies console screen buffer */
  LPTSTR lpszWrite; /* buffer to write characters from */
  DWORD cchWrite; /* number of character cells to write to */
  COORD coordWriteCoord; /* coordinates of first cell to write to */
  LPDWORD lpcWritten; /* actual number or cells written to */

The WriteConsoleOutputCharacter function writes a character string to a console screen buffer beginning at the specified location.

Parameters

hConsoleOutput

Specifies an open handle with GENERIC_WRITE access to a console screen buffer to write to.

lpszWrite

Points to a buffer containing the character string to write to the screen buffer.

cchWrite

Specifies the number of screen buffer character cells to write to.

coordWriteCoord

Specifies the column and row coordinates of the first cell in the screen buffer to write the string to.

lpcWritten

Points to a DWORD that the function will set on exit to the number of characters written to the screen buffer.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. To obtain extended error information, use the GetLastError function.

Comments

This function writes a character string to the screen buffer. If the number of characters to write extends beyond the end of the specified row in the screen buffer, characters are written to the next row. If the number of characters to write extends beyond the end of the screen buffer, the characters up to the end of the screen buffer are written.

The attribute values at the positions written are left unchanged.

The WriteConsoleOutputCharacter function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

WriteConsoleOutput, WriteConsoleOutputAttribute, ReadConsoleOutput, ReadConsoleOutputCharacter, ReadConsoleOutputAttribute