SunQuest
           Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old October 19th, 2000, 10:17 AM
Tigger Tigger is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 0 Tigger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
can anyone help me on this little problem.

im printing a message on screen which i want to replace after a user input like:
print ("Enter command: ");
$Command=<STDIN>;
Print ("nCommand Accepted");

i want to do this but when command accepted is put on screen it replaces Enter command rather than goes under it. can this be done and if so how?

also does anyone know how to change the user input from requireing the user to press enter to complet thier input? i want to be able to use the cursor keys instead of enter. can this be done? if so any pointers?

thanks for your help on this 1.

Tigger


Reply With Quote
  #2  
Old October 20th, 2000, 03:19 PM
tron's Avatar
tron tron is offline
SwollenMember
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Location: the master control
Posts: 234 tron User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 44 m 46 sec
Reputation Power: 9
can you reword your question? what exactly are you trying to do? do you want a new line after it prints "enter command?", if so then just do print "Enter Commandn";

Reply With Quote
  #3  
Old October 21st, 2000, 12:31 AM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 9
Yeah.. you had a lot of random stuff there that doesn't make any sense. Please ask again.

Reply With Quote
  #4  
Old October 21st, 2000, 04:21 AM
Tigger Tigger is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 0 Tigger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
what im exactly trying to do is this:

[1] to print a statement on screen. following this i want to print another statement ontop of the first one NOT under it.

[2] to change $Demand=<STDIN>; so that instead of user input ending when they press enter the user input ends when they press either up or down on the arrow keys.

i hope this clears up exactly what im trying to do and i really hope you can help.


[This message has been edited by Tigger (edited October 21, 2000).]

Reply With Quote
  #5  
Old October 21st, 2000, 07:43 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>following this i want to print another statement ontop of the first one NOT under it

What is following this? After he clicks the submit button? If not, printing to screen goes downward from top to bottom, you can't do that, I wonder what kind of mind you have.

>>user input ends when they press either up or down on the arrow keys

This is just a client side issue.

Your questions have nothing to do with Perl at all.

Reply With Quote
  #6  
Old October 21st, 2000, 09:37 AM
Tigger Tigger is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 0 Tigger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks m8.. yes you can print ontop through using the TK graphics ability but im sure their must be an easier way. Their are abilities to do this in Pascal, Java and C++.

As regarding changing the stdin their MUST be a way as other wise a number of perl applications that i know of wouldn't work.

by the way. if you have nothing helpful to say then don't say anything at all. Ahd about what kind of mind i have, i have a degree in business information systems and am a final year student on a computer sci degree. My questions have everything to do with Perl u gimp.

Reply With Quote
  #7  
Old October 24th, 2000, 12:38 AM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 9
freebsd, if he's using a $var=<STDIN>; input, it's obvious that he's not doing a web-based thing here. It's an interactive thing that being run from a command prompt or something (since http cannot be a persistent connection).

However, I still don't understand the question, oh well.

Reply With Quote
  #8  
Old October 24th, 2000, 05:16 PM
vpopper's Avatar
vpopper vpopper is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Location: Southern California
Posts: 73 vpopper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 24 sec
Reputation Power: 9
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>
[1] to print a statement on screen. following this i want to print another statement ontop of the first one NOT under it.
[/quote]

You can clear the sceen with this command:
print "e[;He[2J";

Then print your new text.

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>
[2] to change $Demand=<STDIN>; so that instead of user input ending when they press enter the user input ends when they press either up or down on the arrow keys.
[/quote]

You can change the input record separator from a newline "n" to an arrow key:

$LEFT_ARROW = 0xAC;
$UP_ARROW = 0xAD;
$RIGHT_ARROW = 0xAE;
$DOWN_ARROW = 0xAF;

$/ = $UP_ARROW;

But your shell will not like the arrow key.

Why do you not want the newline? If it's because of multi-line input, you can change the input record separator ($/) to the escape key or something.




[This message has been edited by vpopper (edited October 24, 2000).]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > A few questions regarding STDIN and print commands


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway