Skip to main content
gamedev.net
🔒 Locked

Console

Started by arithma 4 replies 650+ views
Original Post
arithma
arithma
It is really dumb to ask about this but how can I clear the console I simply couldn't do that
KulSeran
KulSeran
1. print enough '\n' to scroll the text off the screen

2. system ( "cls" ); //(windows)
system ( "clear" ); //(linux)

3. (windows only)
void clrscr(){	COORD coordScreen = { 0, 0 }; 	DWORD cCharsWritten; 	CONSOLE_SCREEN_BUFFER_INFO csbi; 	DWORD dwConSize; 	HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);   	GetConsoleScreenBufferInfo(hConsole, &csbi); 	dwConSize = csbi.dwSize.X * csbi.dwSize.Y; 	FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten); 	GetConsoleScreenBufferInfo(hConsole, &csbi); 	FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); 	SetConsoleCursorPosition(hConsole, coordScreen); }


4. I assume there is something like the above code specific to linux, but I don't know for sure

--To each his own on the choice. Though I'm sure many have an opinion on which way is best
Dave Hunt
Dave Hunt
What operating system? What compiler?
arithma
arithma
Sorry about the misdefined problem...
Am compiling on VS.NET 2003 for windows.
I think the replies are more than enough ;)
Ancient Spirit
Ancient Spirit
Quote:
Original post by KulSeran

4. I assume there is something like the above code specific to linux, but I don't know for sure



Yea there is, it is called ncurses :) check it out if you want it is quite easy and fun :D

This world is ruled by big furry CATS!! :)Meow! :)
Dave Hunt
Dave Hunt
Quote:
Original post by Ancient Spirit
Yea there is, it is called ncurses :) check it out if you want it is quite easy and fun :D


ncurses is quite good. It also makes it easier to port your code to linux/unix later, if you ever want to.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.