How can we clear screen/consol on this online compiler

0 votes
asked Feb 20 by anonymous
I am trying to do clear screen with the help of this compiler but clrscr() and system(cls") functions are not working

1 Answer

0 votes
answered Feb 22 by anonymous
U can use fflush function for such purpose

Syntax of fflush function is

fflush(stdin);
commented Feb 28 by anonymous
Ok, so I tried this:

#include <stdio.h>
int main()
{
    printf("Hello World");
    fflush(stdin);
    printf("Hello World2");
    return 0;
}

But the result is:
Hello WorldHello World2

In other words, commands are recognized (no error message during compilation) but their effects are ignored.
Exactly what is happenig if you try to use clrscr(); or Gotoxy(); from the well know "borland" i/o library.
I'm suspecting there is a bug with GDB online and the output windows.
(The strange fact is it all works fine under GDB online and Pascal.)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...