ReadConsoleOutputCharacter

  BOOL ReadConsoleOutputCharacter(hConsoleOutput, lpszRead, cchRead, coordReadCoord, lpcNumberRead)    
  HANDLE hConsoleOutput;    
  LPTSTR lpszRead;    
  DWORD cchRead;    
  COORD coordReadCoord;    
  LPDWORD lpcNumberRead;    

The ReadConsoleOutputCharacter function reads a string of characters from a console screen buffer beginning at the specified location.

Parameters

hConsoleOutput

Specifies an open handle to a console screen buffer from which to read. The handle must have been created with GENERIC_READ access.

lpszRead

Points to a buffer to receive the character string read from the screen buffer.

cchRead

Specifies the number of screen buffer character cells from which to read. The size of the lpszRead buffer should be cchRead * sizeof(TCHAR).

coordReadCoord

Specifies the column and row coordinates of the first cell in the screen buffer from which to read.

lpcNumberRead

Points to a DWORD that the function will set on exit to the number of characters read.

Return Value

If the function is successful, the return value is TRUE. Otherwise, it is FALSE. Extended error information can be obtained by calling the GetLastError function.

Comments

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

The ReadConsoleOutputCharacter 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

ReadConsoleOutput, ReadConsoleOutputAttribute, WriteConsoleOutput, WriteConsoleOutputAttribute, WriteConsoleOutputCharacter