Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Need constant screen with periodic updates

Reply
Thread Tools

Need constant screen with periodic updates

 
 
Kris Dugan
Guest
Posts: n/a
 
      06-07-2004
I am using a Unix/Solaris 8/9 environment.

I want to make a tool that will constantly read a structure of
information and display that information (or "paint it") to the
screen. Rather than having the information scroll by, I want
a way in which the screen would be "repainted". Sample Screen:

-------------------------------------------------
| foo: 6 bar: 12 |
| this: 18 that: 20 |
|etc. |
-------------------------------------------------

If the values change, I want the screen to be repainted, as opposed
to using "printf" to print it to a screen or logfile.

I am aware that C has the "cursor" libraries, which will do what
I am looking for. Upon first examination, this looked somewhat
complicated. Are there any other modules/libraries that would
accomplish this kind of task (in any other languages) that would
be simple to use?

I am not doing anything with X windows, so this would just be text
to the screen.

 
Reply With Quote
 
 
 
 
Mike Wahler
Guest
Posts: n/a
 
      06-07-2004
"Kris Dugan" <> wrote in message
news:...
> I am using a Unix/Solaris 8/9 environment.
>
> I want to make a tool that will constantly read a structure of
> information and display that information (or "paint it") to the
> screen. Rather than having the information scroll by, I want
> a way in which the screen would be "repainted". Sample Screen:
>
> -------------------------------------------------
> | foo: 6 bar: 12 |
> | this: 18 that: 20 |
> |etc. |
> -------------------------------------------------
>
> If the values change, I want the screen to be repainted, as opposed
> to using "printf" to print it to a screen or logfile.


The standard C language (the topic of comp.lang.c) has
no facilites for this, or for direct control of any
other hardware devices. All i/o is abstracted as
'streams of characters'.

>
> I am aware that C has the "cursor" libraries,


No, the C language has no such thing. However, there exist
'third party' libraries for controlling hardware or interfacing
with operating systems, which have bindings to the C language.

> which will do what
> I am looking for. Upon first examination, this looked somewhat
> complicated.


Many of them are, imo in the interest of 'completeness',
and the desire to address many different needs.

> Are there any other modules/libraries that would
> accomplish this kind of task (in any other languages) that would
> be simple to use?


Many C implementations offer 'extensions' to the standard
library which can be used for more 'intimate' interaction
with the host platform (e.g. see MSVC++'s 'console functions').
Lacking that, you will need to choose a third-party library
and learn how to use it.

Also available for some implementations are 'device drivers'
to which one can send text commands and will translate them
into 'native' video hardware commands, such as 'move cursor',
etc. Google can help with finding them.

> I am not doing anything with X windows, so this would just be text
> to the screen.


Sorry but the C language has no notion of 'screen', only
the abstraction known as the 'standard output channel'.

Try checking your compiler documentation, consulting its
author's support resources, or asking in a newsgroup where
it's topical.

-Mike


 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      06-07-2004

Quoth Kris Dugan <>:
> I am using a Unix/Solaris 8/9 environment.
>
> I want to make a tool that will constantly read a structure of
> information and display that information (or "paint it") to the
> screen. Rather than having the information scroll by, I want
> a way in which the screen would be "repainted". Sample Screen:
>
> -------------------------------------------------
> | foo: 6 bar: 12 |
> | this: 18 that: 20 |
> |etc. |
> -------------------------------------------------
>
> If the values change, I want the screen to be repainted, as opposed
> to using "printf" to print it to a screen or logfile.
>
> I am aware that C has the "cursor" libraries, which will do what
> I am looking for. Upon first examination, this looked somewhat
> complicated. Are there any other modules/libraries that would
> accomplish this kind of task (in any other languages) that would
> be simple to use?


In Perl you can use Term::ANSIScreen to achieve this (very easily).

Ben

--
Although few may originate a policy, we are all able to judge it.
- Pericles of Athens, c.430 B.C.

 
Reply With Quote
 
Randal L. Schwartz
Guest
Posts: n/a
 
      06-07-2004
>>>>> "Kris" == Kris Dugan <> writes:

Kris> I want to make a tool that will constantly read a structure of
Kris> information and display that information (or "paint it") to the
Kris> screen. Rather than having the information scroll by, I want
Kris> a way in which the screen would be "repainted".

Sounds like a perfect job for Curses.pm. Look in to it.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
 
Reply With Quote
 
Gregory Toomey
Guest
Posts: n/a
 
      06-08-2004
Kris Dugan wrote:

> I am using a Unix/Solaris 8/9 environment.
>
> I want to make a tool that will constantly read a structure of
> information and display that information (or "paint it") to the
> screen. Rather than having the information scroll by, I want
> a way in which the screen would be "repainted". Sample Screen:


Easiest Perl way:

system('clear');
print "new info ..."


gtoomey
 
Reply With Quote
 
Ben Morrow
Guest
Posts: n/a
 
      06-08-2004

Quoth Gregory Toomey <>:
> Kris Dugan wrote:
>
> > I am using a Unix/Solaris 8/9 environment.
> >
> > I want to make a tool that will constantly read a structure of
> > information and display that information (or "paint it") to the
> > screen. Rather than having the information scroll by, I want
> > a way in which the screen would be "repainted". Sample Screen:

>
> Easiest Perl way:
>
> system('clear');
> print "new info ..."


Come now, using external programs for something that simple is nearly
always wrong.

use Term::ANSIScreen qw/:screen :cursor/;

locate 1, 1;
cls;
print "...";

For some reason I have found that both cls and clline only work for me
if I locate to the start of the region to be cleared first... I am
presuming this is a bug in eiher Term::ANSIScreen or the linux console
driver .

Ben

--
The cosmos, at best, is like a rubbish heap scattered at random.
- Heraclitus

 
Reply With Quote
 
Joe Smith
Guest
Posts: n/a
 
      06-08-2004
Ben Morrow wrote:

> use Term::ANSIScreen qw/:screen :cursor/;
>
> locate 1, 1;
> cls;
> print "...";
>
> For some reason I have found that both cls and clline only work for me
> if I locate to the start of the region to be cleared first.


That's a bug in your terminal emulator; it is not responding to escape
sequences as per the ANSI specs.

cldown = "\x33[0J" = clear from location to end of screen
clup = "\x33[1J" = clear from beginning of screen to location
cls = "\x33[2J" = clear the entire screen

> presuming this is a bug in the linux console driver .


Works fine with xterm, gnome-terminal, and the Linux 2.4.20 console.
-Joe
 
Reply With Quote
 
Ben Morrow
Guest
Posts: n/a
 
      06-08-2004

Quoth Joe Smith <>:
> Ben Morrow wrote:
>
> > use Term::ANSIScreen qw/:screen :cursor/;
> >
> > locate 1, 1;
> > cls;
> > print "...";
> >
> > For some reason I have found that both cls and clline only work for me
> > if I locate to the start of the region to be cleared first.

>
> That's a bug in your terminal emulator; it is not responding to escape
> sequences as per the ANSI specs.
>
> cldown = "\x33[0J" = clear from location to end of screen
> clup = "\x33[1J" = clear from beginning of screen to location
> cls = "\x33[2J" = clear the entire screen


I suspected as much. I didn't *really* think it likely that there would
be a bug in a module as simple as Term::ANSIScreen .

> > presuming this is a bug in the linux console driver .

>
> Works fine with xterm, gnome-terminal, and the Linux 2.4.20 console.


Linux 2.6.3 console, in UTF-8 mode. I suspect the latter may be the
problem...

Ben

--
Heracles: Vulture! Here's a titbit for you / A few dried molecules of the gall
From the liver of a friend of yours. / Excuse the arrow but I have no spoon.
(Ted Hughes, [ Heracles shoots Vulture with arrow. Vulture bursts into ]
/Alcestis/) [ flame, and falls out of sight. ]
 
Reply With Quote
 
Thomas Dickey
Guest
Posts: n/a
 
      06-08-2004
In comp.lang.perl.misc Ben Morrow <> wrote:

> Quoth Joe Smith <>:
>> Ben Morrow wrote:
>>
>> > use Term::ANSIScreen qw/:screen :cursor/;
>> >
>> > locate 1, 1;
>> > cls;
>> > print "...";
>> >
>> > For some reason I have found that both cls and clline only work for me
>> > if I locate to the start of the region to be cleared first.

>>
>> That's a bug in your terminal emulator; it is not responding to escape
>> sequences as per the ANSI specs.
>>
>> cldown = "\x33[0J" = clear from location to end of screen
>> clup = "\x33[1J" = clear from beginning of screen to location
>> cls = "\x33[2J" = clear the entire screen


> I suspected as much. I didn't *really* think it likely that there would
> be a bug in a module as simple as Term::ANSIScreen .


>> > presuming this is a bug in the linux console driver .

>>
>> Works fine with xterm, gnome-terminal, and the Linux 2.4.20 console.


> Linux 2.6.3 console, in UTF-8 mode. I suspect the latter may be the
> problem...


....or the perl script (the defect you're describing is a well-known defect
of the so-called "ansi.sys" - perhaps someone made the perl script follow it).

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To generate a periodic time-gate vizziee@gmail.com VHDL 2 05-22-2009 12:18 AM
Periodic disconnects ZX4 Wireless Networking 1 01-28-2006 03:24 PM
Periodic breaks in connection between router and PCMCIA card steve2470 Wireless Networking 2 08-02-2005 01:10 AM
aaa accounting update periodic stopped working on 12.3.13 Yehavi Bourvine Cisco 1 03-13-2005 04:06 PM
Need constant screen with periodic updates Kris Dugan Perl Misc 11 06-09-2004 07:58 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57