Народ, кто знает как в консоли VC 6 очиcтеть экран, clrscr() в conio.h нет?
Здравствуйте Murmansk, Вы писали:
M>Народ, кто знает как в консоли VC 6 очиcтеть экран, clrscr() в conio.h нет?
http://www.rsdn.ru/forum/?mid=55148Автор: ak_alex
Дата: 17.05.02
Здравствуйте Murmansk, Вы писали:
M>Народ, кто знает как в консоли VC 6 очиcтеть экран, clrscr() в conio.h нет?
А почему бы тебе просто не вывести много пустых срок!
Здравствуйте Murmansk, Вы писали:
M>Народ, кто знает как в консоли VC 6 очиcтеть экран, clrscr() в conio.h нет?
/************************************************************************
* FUNCTION: cls(HANDLE hConsole) *
* *
* PURPOSE: clear the screen by filling it with blanks, then home cursor *
* *
* INPUT: the console buffer to clear *
* *
* RETURNS: none *
*************************************************************************/
void cls(HANDLE hConsole)
{
COORD coordScreen = { 0, 0 }; /* here's where we'll home the cursor */
BOOL bSuccess;
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi; /* to get buffer info */
DWORD dwConSize; /* number of character cells in the current buffer */
/* get the number of character cells in the current buffer */
bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);
PERR(bSuccess, "GetConsoleScreenBufferInfo");
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
/* fill the entire screen with blanks */
bSuccess = FillConsoleOutputCharacter(hConsole, (TCHAR) ' ',
dwConSize, coordScreen, &cCharsWritten);
PERR(bSuccess, "FillConsoleOutputCharacter");
/* get the current text attribute */
bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);
PERR(bSuccess, "ConsoleScreenBufferInfo");
/* now set the buffer's attributes accordingly */
bSuccess = FillConsoleOutputAttribute(hConsole, csbi.wAttributes,
dwConSize, coordScreen, &cCharsWritten);
PERR(bSuccess, "FillConsoleOutputAttribute");
/* put the cursor at (0, 0) */
bSuccess = SetConsoleCursorPosition(hConsole, coordScreen);
PERR(bSuccess, "SetConsoleCursorPosition");
return;
}