clear screen

what is the syntax for clearing the screen in c ?
when i tried "Clrscr()" the CC complier does not reconise it.
please do tell me more about this.
thanking you

                            imma

yes clrscr() works for me. I tried using curces.h

#include <curses.h>

void clrscr()
{

in the end of your code use

clear\(\);

refresh();
}

Is there any compiler argument that has to been entered when compiling to invoke those funktions?

I only got a SEGfault with gcc.

clear(); does not clear the screen.
and I cant compile with refresh(); in the code.

I'm kind of new in c programming to so excuse my question.
But I'm learning :smiley:

Thanks!

Curses is a subsystem (library) for managing character screens. Using it involves more than just calling the clear-screen function. You have to initialize it, etc.

From your question, it isn't clear to me that you are using Curses. If you want to, that's a study in itself, and there are several books on the subject, and probably some tutorials you can find on the web.

Aside from Curses, there is no standard way to clear the screen, or even to treat the terminal AS a screen. Standard C assume that the terminal is a line-at-a-time device.

Try this:

#include <curses.h>

int  main(void)
{
     initscr();
     clear();
     refresh();
     endwin();
}

And compile with:
cc prog.c -o prog -lcurses

Ok, thanks!
There is an other way else with:
#include <stdlib.h>
int main(void)
{
system("clear");
}

but there is allways fun to explorer new ways in doing things :slight_smile:
I will go straight home now and read the manpages inside and out :smiley:

later!

well its great to read all this ...sometimes its really wonderfull
to know the diffrent algrorithm or approach for a simple progam
or commands ...which we often use it.

                 imma