Create your own function in your own header file that contains clrscr () and uses it. eg:
#include <stdlib.h> void clrscr() { system("cls"); }
save it as "ClearScreen.h" in your path to the "include" folder (for ex - C: \ Program Files (x86) \ CodeBlocks \ MinGW \ include)
compile it.
now use it in your programs, for example:
#include <stdio.h> #include <conio.h> #include <ClearScreen.h> main() { clrscr(); printf("\nHi"); getch(); return 0; }
now compile and run it. I hope this works.
source share