Archived

This topic is now archived and is closed to further replies.

Console window stuff

This topic is 5151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright, conio.h will not help you then.


#include <windows.h>

void setcolor(WORD color) {
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color);
}

void gotoxy(SHORT x, SHORT y) {
COORD p = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), p);
}


Use setcolor() to change the default text color. Use gotoxy() to move to a location on the console screen buffer. To erase, simply write spaces or what have you.


Colin Jeanne | Invader's Realm

[edited by - Invader X on November 7, 2003 12:28:40 AM]

Share this post


Link to post
Share on other sites
Look up "Console Functions" in the Win32 reference guide. (eg CreateConsoleScreenBuffer, SetConsoleTitle, GetConsoleCursorInfo etc.) If you find the Console Functions section.. they''ll all be there .

Share this post


Link to post
Share on other sites