i know there is a function that is to clear the screen for further operation.
the header file needed for it is conio.h
i forgot wat is the function. i tried clrscr() but fail.
anyone know ?
i know there is a function that is to clear the screen for further operation.
the header file needed for it is conio.h
i forgot wat is the function. i tried clrscr() but fail.
anyone know ?
Try the FAQ
I recommend option 6
this code like cannot be used in visual c++
is there any other function that works the same ?
Option 6 was a joke....Originally posted by monkeymon
this code like cannot be used in visual c++
is there any other function that works the same ?
....but if only you had kept reading
Code:WINDOWS OPTION: (Credit: Sunlight) Just call the function clrscr(). Simple as that. #include <windows.h> 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); }
im doing a console programing will that work also ? Fordy
i try already but dun seem to work
Last edited by monkeymon; 10-05-2002 at 11:05 AM.
This compiles fine in VC++
Code:#include <iostream> using std::cout; using std::endl; #include <windows.h> 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); } int main(){ const int nTimes = 3; const int nSpeed = 3000; for(int i = 0;i < nTimes;i++){ cout << "Few seconds to clear screen!!..Hang on!" << endl; Sleep(nSpeed); clrscr(); Sleep(nSpeed); } cout << "That's all folks!" << endl; return 0; }
thanks for your help ...
now it can work already ...