Quote:
Originally Posted by SaswatPadhi
That will
NOT work for compilers which conform to ANSI C, 'cuz the clrscr() is no more present.
So, you can use
system("CLS"); to clear screen, but that's OS specific.
So it's better to write a user-defined func like :
Code: C
void ClearScreen(void)</p>
<p>{</p>
<p> HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);</p>
<p> CONSOLE_SCREEN_BUFFER_INFO csbi;</p>
<p> GetConsoleScreenBufferInfo(hStdout,&csbi);</p>
<p> const COORD startCoords = {0,0};</p>
<p> DWORD dummy;</p>
<p> </p>
<p> FillConsoleOutputCharacter(hStdout,' ',csbi.dwSize.X * csbi.dwSize.Y,startCoords,&dummy);</p>
<p> SetConsoleCursorPosition(hStdout, startCoords);</p>
<p>}</p>
<p>
Remember to
#include <windows.h>.
excuse me but it's not working and has a error like this:
error C2601: 'ClearScreen' : local function definitions are illegal