?
Solved

Stupid question about input/output

Posted on 2005-02-26
3
Medium Priority
?
197 Views
Last Modified: 2011-09-20
I'm working on a little telnet app, but this is my first time doing anything beyond a textbook in Perl. This program receives lines of text from a server, and sends lines typed at the console, and that's about it. When I input something into the program, if another line is received from the server, it kind of chops what I was typing and puts it in front of the data that was just sent, leaving half of what I was typing on the line before, and also in the text buffer. I hope I'm making myself clear enough here... but basically, how can I set it so that input only shows up on the bottom line, until I press enter, and not scroll into the rest of the buffer? (just disappear after enter is hit?)
0
Comment
Question by:Tabris42
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Expert Comment

by:Talmash
ID: 13413640
can you copy paste here some JAMMED output ?

as I understand, 2 agents write to the same OUTPUT:
the server and you , am I right ?

if there is a script that sends logs to the OUTPUT, in perl, this may help :

 select(STDERR); $| = 1; # make unbuffered - print to screen immediately
 select(STDOUT); $| = 1; # make unbuffered - print to screen immediately

I assume your access to the file is stronger then that of the server, so what you write byrst into what the server is trying to write. the above 2 lines will give the server "a higher" prio accessing the OUTPUT.

tal
0
 

Author Comment

by:Tabris42
ID: 13413681
Here's an example. I connect and type "Asdas, which would be the command to 'say' Asdas. It takes what I've written after I press enter and adds it to the buffer.

"Asdas                 #This was written by me, I press enter.
You say, "Asdas"   #This line came from the connection

What I would like is to be able to just type "Asdas, press enter, have You say, "Asdas" show up on screen, but not the command I just entered.

0
 
LVL 20

Accepted Solution

by:
jmcg earned 2000 total points
ID: 13414332
It sounds like you're writing what's known in the Windows world as a "console app".

Unless you wish to add the complexity of a GUI to your program, the intermediate step for achieving what you want is to use a package like "curses" to control what is displayed on the screen. You can do something like establish an input area at the bottom of the screen and post the responses coming back from the server in a scrolled region above that. I'm afraid I don't know of a good example of this method that's written in Perl.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question