
![]() |
Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
|
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[3.145.53.93] |
![]() |
|
![]() |
|
|
ОСь: Windows
Компилятор: VC++6(cl.exe) Здравствуйте. Подскажите пожалуйста в чем может быть проблема. При компиляции программы с вызовом функции clrsrc(), компилятор выдает ошибку: ![]() ![]() error C2065: 'clrscr' : undeclared identifier Насколько мне известно, эта функция описывается в файле conio.h, но он подключен. Его замена ни чем не помогла. P.S. Не сочтите мой вопрос ламерским, просто я только начал изучать язык C ![]() |
Сообщ.
#2
,
|
|
|
Цитата h2all @ - нету в VC, импользуй system("cls"); clrscr Добавлено P.S. #include <stdlib.h> |
Сообщ.
#3
,
|
|
|
Или подключить conio.h
![]() |
Сообщ.
#4
,
|
|
|
![]() ![]() /*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:*/ #include <stdlib.h> void main() { system("cls"); } /* The second method is to write a function that will programmatically clear the screen. That method is described in the More Information section which follows. MORE INFORMATION The following function clears the screen: */ /* 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; } |
Сообщ.
#5
,
|
|
|
Цитата Lyrik @ В котором нет clrscr Или подключить conio.h ![]() |
Сообщ.
#6
,
|
|
|
Спасибо всем кто ответил. Получилось. Как быстро со всем разобрались.
trainer, ты говоришь что в conio.h нет clrscr, но я на курсах использовал именно его ![]() P.S. А что нужно подключить чтобы заработала функция textbackground(), а то на курсах работает а дома нет ![]() |
Сообщ.
#7
,
|
|
|
Цитата h2all trainer, ты говоришь что в conio.h нет clrscr, но я на курсах использовал именно его в микрософтофском conio.h нет clrscr. И textbackground там тоже нет ![]() Может тебе все-таки на борланд перейти? |
Сообщ.
#8
,
|
|
|
Цитата Adil @ Или вернуться? Может тебе все-таки на борланд перейти? ![]() |
Сообщ.
#9
,
|
|
|
Действительно на курсах стоит Borland, а дома VC. А нельзя ли борландский conio.h подключать к проэктам на VC, и если нельзя, подскажите где можно почитать о vc's функциях по работе со цветом (textcolor, cputs и т.д.)?
|
Сообщ.
#10
,
|
|
|
![]() |