Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How can we clear screen/consol on this online compiler

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

2 Answers

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

Syntax of fflush function is

fflush(stdin);
commented Feb 28, 2020 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.)
0 votes
answered Jan 12 by Rahul Rao (140 points)
Clrscr(); are not working in online gdb
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.
...