473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Need constant screen with periodic updates

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.

Nov 14 '05 #1
8 1602
"Kris Dugan" <cj*****@lucent.com> wrote in message
news:40**************@lucent.com...
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
Nov 14 '05 #2

Quoth Kris Dugan <cj*****@lucent.com>:
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.
be*@morrow.me.uk
Nov 14 '05 #3
>>>>> "Kris" == Kris Dugan <cj*****@lucent.com> 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
<me****@stonehenge.com> <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!
Nov 14 '05 #4
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
Nov 14 '05 #5

Quoth Gregory Toomey <no****@bigpond.com>:
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
be*@morrow.me.uk
Nov 14 '05 #6
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
Nov 14 '05 #7

Quoth Joe Smith <Jo*******@inwap.com>:
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. ] be*@morrow.me.uk
Nov 14 '05 #8
In comp.lang.perl.misc Ben Morrow <us****@morrow.me.uk> wrote:
Quoth Joe Smith <Jo*******@inwap.com>:
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
Nov 14 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Hans Forbrich | last post by:
Section 1. Ballot: ------------------- 1.YES NO: I agree that there should be a periodic post describing the newsgroup charter and providing a FAQ on newsgroup usage. 2.MONTHLY BI-WEEKLY...
0
by: Hans Forbrich | last post by:
Section 1. Ballot: ------------------- 1.YES NO: I agree that there should be a periodic post describing the newsgroup charter and providing a FAQ on newsgroup usage. 2.MONTHLY BI-WEEKLY...
13
by: Joe Black | last post by:
Just to inform you guys that i have only like 2 weeks that i took my first classes in c++, and my proffesor now is asking me to solve this problem: /// Using a function create a Win32 Console...
2
by: Susan Bricker | last post by:
Greetings. Before I begin, I have been stuck on this problem for about a 5 days, now. I have tried and just seem to be not getting anywhere. I know that the explanation is lengthy, but I am a...
3
by: Shmulik | last post by:
I have an application written in C# that creates a queue of items to process, connects via a TCP connection to a server on a Unix box, and then passes data files to the Unix box for processing...
5
by: nishantxl | last post by:
Hi there, I am looking to design a project using C++ The main objective of the project is to display details of periodic table elements such as periodic element name, properties(such as atomic...
1
by: batista | last post by:
Hello all, I have a third praty grid control...named C1grid. Im using it in one of my apps.. Now, I have bind this grid to a custom dataset class named "DataViewEx". The code of the class is...
8
by: jmorgan | last post by:
<html> <b>Hi, I thought that the memory address of DOS screen is 0x0b00. But this didnt work for me. Can anyone help in accessing the screen by using this address. </b> </html>
4
by: Alfredo73 | last post by:
Hi, I am using Visual Basic 2008 to create some databases. It reads data from textfiles and puts them in SQL databases. After the user presses the Process button I would like to give the user to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.