FillConsoleOutputCharacter

  BOOL FillConsoleOutputCharacter(hConsole, chFillChar, cCharCells, coordChar, lpcWritten)    
  HANDLE hConsole; /* screen buffer handle to write to */
  TCHAR chFillChar; /* character to write */
  DWORD cCharCells; /* number of character cells to write to */
  COORD coordChar; /* x and y coordinates of first cell */
  LPDWORD lpcWritten; /* receives number of cells written to */

The FillConsoleOutputCharacter function writes a character to the screen buffer a specified number of times beginning at the specified coordinates.

Parameters

hConsole

Specifies an open handle to a screen buffer (CONOUT$). The handle must have been created with GENERIC_WRITE access.

chFillChar

Specifies the character to write to the screen buffer.

cCharCells

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

coordChar

Specifies a COORD structure containing the screen buffer coordinates of the first cell to write the character to.

The COORD structure has the following format:

typedef struct _COORD { /* coord */

SHORT X; /* horizontal coordinate */

SHORT Y; /* vertical coordinate */

} COORD, *PCOORD;

lpcWritten

Points to the variable that will receive the number of characters actually written to the screen buffer.

Return Value

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

Comments

The FillConsoleOutputCharacter 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).

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.

See Also

FillConsoleOutputAttribute