Hello everybody.
I'm trying to write to the console with WriteConsoleOutput, but I get some
errors during compilation.
The code I've written so far:
Code:
//--------------------------------------------------------------------------------------------------
//Display a 80cols x 25 rows fixed size console
//--------------------------------------------------------------------------------------------------
void DisplayCon(char target[]){
COORD bufferSize = {80, 25};
COORD TopLeft = {0,0};
SMALL_RECT Out_buf;
Out_buf.Left = 0;
Out_buf.Top = 0;
Out_buf.Right = 24;
Out_buf.Bottom = 79;
WriteConsoleOutput(wHnd, target, bufferSize, TopLeft, Out_buf);
return;
}
When I compile I get these errors:
Code:
Type error in argument 2 to 'function'; expected 'const CHAR_INFO *' but found 'char *'.
Type error in argument 5 to 'function'; expected 'PSMALL_RECT' but found 'SMALL_RECT'.
regarding the WriteConsoleOutput call.
What am I missing?
The array I'm using to store the data to be displayed: target[] should
be a CHAR_INFO structure. If I want to use the same area using union,
the same that I'm using for array target[], how should I define the structure?
CHAR_INFO has already a union inside:
Code:
typedef struct _CHAR_INFO { // chi
union { /* Unicode or ANSI character */
WCHAR UnicodeChar;
CHAR AsciiChar;
} Char;
WORD Attributes; // text and background colors
} CHAR_INFO, *PCHAR_INFO;
I am not able to figure how should I declare the structure with a union to
have the same area of 8000 bytes usable in both array mode and struct mode.
Thanks for any help you can give me.