I'm completely flummoxed by the code below for a simple console program.
I can print the character at the corners except for the bottom right.
If I uncomment the lines to do so the window seems to scroll up a line.
What's going on?
Code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#define CH 219
#define COLS 80
#define ROWS 25
static void set_coord(int x, int y,HANDLE console_handle);
int main(void)
{
CONSOLE_CURSOR_INFO cci;
COORD buffersize = {COLS,ROWS};
HANDLE console_handle;
cci.dwSize = 1;
cci.bVisible = 0;
console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleScreenBufferSize(console_handle, buffersize);
SetConsoleCursorInfo(console_handle,&cci); // hide cursor
set_coord(0,0,console_handle);
printf("%c",CH);
set_coord(79,0,console_handle);
printf("%c",CH);
set_coord(0,24,console_handle);
printf("%c",CH);
//set_coord(79,24,console_handle);
//printf("%c",CH);
//set_coord(0,0,console_handle);
getchar();
return 0;
}
static void set_coord(int x, int y,HANDLE console_handle)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(console_handle, coord);
}