This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: how to clear screen ??



>>>>> "Martijn" == Martijn  <nobody@nowhere.org> writes:

    Martijn> Thanx for the reaction....  but what I meant was: How can
    Martijn> I get my screen cleared from within my c-program??

But you said you wanted to clear the screen while running gcc. What
you should have said was "while running my gcc-compiled program",
unless you're writing gcc of course :)

Anyway, the following should work on most systems:

system("clear");

or

system("tput clear");

or echo the clear's escape code itself, it's usually portable for
commonly used terminals, but not always.

Find out the code from:

[lokeshs@solaris] ~> tput clear | od -c
0000000 033   [   H 033   [   2   J
0000007
[lokeshs@solaris] ~> 

So, you print "Esc [ H Esc [ 2 J", 
that's "\033[H\033[2J" if you use printf(); (be sure to flush out
yourself as it does'nt contain a newline).

HTH,
Lokesh.




    Martijn> Lokesh Setia <lokeshs@sh.bel.alcatel.be> wrote in message
    Martijn> news:xnhk8n0yno9.fsf@sh.bel.alcatel.be...
    >>  Write "clear" in your shell and press enter before you run
    >> gcc.  or type Control-L if you use bash or tcsh as your shell.
    >> 
    >> Regards, Lokesh.
    >> 
    >> 
    >> >>>>> "Martijn" == Martijn <nobody@nowhere.org> writes:
    >> 
    Martijn> Hello everyone, I'm a gcc newbe As in the subject: What
    Martijn> is the command (or perhaps: trick) to clear your screen
    Martijn> while running gcc in your terminal-mode?
    >>
    Martijn> thanx,
    >>
    Martijn> Martijn
    >> 
    >> 
    >> 
    >> -- When we come back, I'll drop a line. (The Doors)



-- 
When we come back, I'll drop a line. (The Doors)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]