[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] RE: script timer



Chakrabarti, Suvendra (CTS) forced the electrons to say:
>      Hi Binand,
> 
>      Curses uses the termcap entries. If we know we are working
>      on a ANSI compliant terminal we can avoid Curses by giving
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What if we are not?

Curses is the completely portable solution to the clearing screen problem,
and a few others ones that come up quite regularly, like non-echoing
input, reading a character without pressing the enter key and so on. The
curses functions I mentioned are POSIX conformant, so you can rest assured
that the code will compile and run on any POSIX system. After working
on 5 different Unix versions in the past four years, I understand the
implications of writing portable code.

The point is, you don't have to change the code every time you sit on
a different terminal.

>      printf("%c[2J", 27);
 
Again, hard coding ASCII is bad, and works against portable code.

>      This will clear the screen, and that is what I meant. I don't
>      think we need to use curses, just for clearing screens.

And why not? The library is there to be used.

Anyway, a semi-portable method to clear the screen is

printf ("\f"); fflush (stdout);

Binand
- --------------------------------------------------------------------
For more information on Linux in India visit http://www.linux-india.org/
The Linux India mailing list does not accept postings in HTML format.

------------------------------