Quote:
Originally Posted by shabbir View Post
clrscr is one of the easier option.
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)
{
      HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
      CONSOLE_SCREEN_BUFFER_INFO csbi;
      GetConsoleScreenBufferInfo(hStdout,&csbi);
      const COORD startCoords = {0,0};
      DWORD dummy;

      FillConsoleOutputCharacter(hStdout,' ',csbi.dwSize.X * csbi.dwSize.Y,startCoords,&dummy);
      SetConsoleCursorPosition(hStdout, startCoords);
}

Remember to #include <windows.h>.