This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

Re: clear screen?


Hello, $Bill:

Sorry to say this: the second way you mentioned does not work:

> 2) compile this into clear.exe or cls.exe:
>         #include <stdio.h>
>         int main () { printf("033[2J"); }

Here is an example that will work ( use g++ -o cls cls.cpp ):

[cls.cpp]

#include <iostream.h>
 
int main () {
char a = 27u;
cout << a << "[2J";
return 0;
}

And I am sure that you can figure out several ways to do this in pure C in order to generate a more compact binary executable file.

Sincerely,
Wei Ku

***************************************
Department of Physics and Astronomy
The University of Tennessee
1408 Circle Drive
Knoxville, Tennessee 37996-1200
weiku@utkux.utcc.utk.edu
---------------------------------------
Solid State Division
Oak Ridge National Laboratory
P.O.Box 2008
Oak Ridge, TN 37831-6032
Phone: (423) 574-5795
Fax: (423) 574-4143
weiku@solid.ssd.ornl.gov
***************************************

----
From: $Bill Luebkert <dbe@wgn.net>
To: john.cooper@digitivity.com
Cc: GNU-Win32@cygnus.com
Date: Tuesday, July 01, 1997 6:47 PM
Subject: Re: clear screen?

John Cooper wrote:
>
> Is there a command to clear the screen when using bash?
>
> `type clear' and `type cls' reveal nothing.

Here's three things you can try:

1) alias cls='echo -n ^[[2J'            # the ^[ is an esc (in vi I use ^V followed by
                                        # ^[ where ^ is holding down the cntrl key)

2) compile this into clear.exe or cls.exe:

        #include <stdio.h>
        int main () { printf("033[2J"); }

3) alias cls='cat ~/.cls'
        where .cls contains just these 4 chars with no \n or spaces (ESC [ 2 J)

HTH,
--
  ,-/-  __      _  _         $Bill Luebkert
(_/   /  )    // //       DBE Collectibles
  / ) /--<  o // //      http://www.wgn.net/~dbe/
-/-' /___/_<_</_</_    Email: dbe@wgn.net
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

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