Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clean up console

Status
Not open for further replies.

vcllvc

Programmer
Jul 12, 2001
136
US
does anyone know how to clean up/refresh the screen in c++ code? What I mean the screen is the MS_DOS console.

Thanks in advance

Vincent
 
system("cls"); John Fill
1c.bmp


ivfmd@mail.md
 
I'm sorry, do i need to include any library? And I can just call this function?

Thanks
Vincent
 
yes, #include<process.h> of #inlcude<stdlib.h> John Fill
1c.bmp


ivfmd@mail.md
 
hey, where can I look up those function and how do I know what these function do? There are so many libraries. Please give me some hints so that I can look it up next time I have problem to find out what I need.

Thanks
Vincent
 
#include<stdlib.h>
int main()
{
system(&quot;cls&quot;);
return 0;
} John Fill
1c.bmp


ivfmd@mail.md
 
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);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top