?
Solved

Stupid question about input/output

Posted on 2005-02-26
3
Medium Priority
?
201 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
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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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

621 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