Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / C++ [игнор отключен] [закрыт для гостей] / How to clean console window? (HELP) / 5 сообщений из 5, страница 1 из 1
24.10.2006, 12:09
    #34076481
chip7et
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
How to clean console window? (HELP)
Подскажите пожайлуста, какой функцией можно очистить окно консоли в windows.
спасибо
...
Рейтинг: 0 / 0
24.10.2006, 12:17
    #34076506
Wavesql
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
How to clean console window? (HELP)
clrscr();
...
Рейтинг: 0 / 0
24.10.2006, 13:39
    #34076922
chip7et
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
How to clean console window? (HELP)
а какой заголовочный файл используется?
...
Рейтинг: 0 / 0
24.10.2006, 13:54
    #34076990
How to clean console window? (HELP)
chip7etПодскажите пожайлуста, какой функцией можно очистить окно консоли в windows.
спасибо
Не слушай никого Вот тебе советы от "Дяди Билла":
Microsoft MSDN Help

SUMMARY
Some non-Microsoft versions of C++ provide a clrscr function for clearing the screen in a DOS application. However, there is no Win32 Application Programming Interface (API) or C-Runtime function that will perform this function.


There are two ways to accomplish this task for a Win32 console application. The first method is to use the system function as follows:

Код: plaintext
1.
2.
3.
4.
5.
6.
#include <stdlib.h>

void main()
{
   system("cls");
} 

The second method is to write a function that will programmatically clear the screen.
The following function clears the screen:

Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
 /* Standard error macro for reporting API errors */ 
 #define PERR(bSuccess, api){if(!(bSuccess)) printf("%s:Error %d from %s \ 
    on line %d\n", __FILE__, GetLastError(), api, __LINE__);}

 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;
 } 
...
Рейтинг: 0 / 0
24.10.2006, 14:33
    #34077181
chip7et
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
How to clean console window? (HELP)
thx, а я msdn не нашел ничего.

А вообще супер, спасибо))!!!
...
Рейтинг: 0 / 0
Форумы / C++ [игнор отключен] [закрыт для гостей] / How to clean console window? (HELP) / 5 сообщений из 5, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]