For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > May 2004 > [C-Bash] Output control in linux shell









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [C-Bash] Output control in linux shell
Louis Cyphre

2004-05-22, 5:31 pm

Small question...
...I'm writing a simple textual chat in C for linux bash shell but I met
some problems about the output handling of the client program. Simply I want
to
divide the screen into two parts: the last line, displaying the text I'm
writing before I send a message, and the remaining lines for messages sent
and recieved... just as a classic chat.

How can I control the output in this way?
....other solutions to output control are welcome.

__________________
:: Louis Cyphre ::








Måns Rullgård

2004-05-22, 5:31 pm

"Louis Cyphre" <metalmessiah@libero.it> writes:

> Small question...
> ...I'm writing a simple textual chat in C for linux bash shell but I met
> some problems about the output handling of the client program. Simply I want
> to
> divide the screen into two parts: the last line, displaying the text I'm
> writing before I send a message, and the remaining lines for messages sent
> and recieved... just as a classic chat.
>
> How can I control the output in this way?
> ...other solutions to output control are welcome.


curses

--
Måns Rullgård
mru@kth.se
Viktor Lofgren

2004-05-22, 7:35 pm

Louis Cyphre <metalmessiah@libero.it> wrote:
> Small question...
> ...I'm writing a simple textual chat in C for linux bash shell but I met
> some problems about the output handling of the client program. Simply I want
> to
> divide the screen into two parts: the last line, displaying the text I'm
> writing before I send a message, and the remaining lines for messages sent
> and recieved... just as a classic chat.
>
> How can I control the output in this way?
> ...other solutions to output control are welcome.


You could do this in two ways:
#1 curses. easy.
#2, if you're curses-phobic like me: look at tcsetattr(3), the ANSI terminal
escape sequences and asynchronous mode input. Pretty much the same as curses
but with lower level access and no external libaries and strange APIs.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com