On Wed, 24 Mar 1999, philippe boyer wrote:

> Hi,
> 
>     I am trying  to read charaters  from stdin. the only way I have
> found is
> 
> puts "type your name"
> puts -nonewline ">  "
> set name [read stdin]
> 
> the problem is to stop reading character when enter is pressed. I have
> found another  way to end the line read but it is not very funny: type
> space, CTRL-z, enter, CTRL-z enter. Afterwards, command [read stdio]
> returns. if I want to get the correct name typed, I am forced to use:
> 
> set name [llindex $lineRead 0]
> 
> in order to remove the CTRL-z from string.

Well, you should be able to do this

puts "type your name"
puts -nonewline ">  "

set num [gets stdin name]
puts "read $num bytes, name is \"$name\""


But there seems to be a bug in Jacl that does not allow this.
When I ran this test code I got a NullPointerException.

I am going to look into this and see if I can find where the
problem is.

later
mo
 
> is anyone have an easier way to read a simple line from stdin finished
> by enter?
> 
> PS: I am using NT/jdk1.2/jacl1.1.1
> 
> philoux - france
> 
> 
> ----------------------------------------------------------------
> The TclJava mailing list is sponsored by WebNet Technologies.
> To subscribe:    send mail to [EMAIL PROTECTED]  
>                  with the word SUBSCRIBE as the subject.
> To unsubscribe:  send mail to [EMAIL PROTECTED] 
>                  with the word UNSUBSCRIBE as the subject.
> To send to the list, send email to '[EMAIL PROTECTED]'. 
> A list archive is at: http://www.findmail.com/listsaver/tcldallas/
> 

----------------------------------------------------------------
The TclJava mailing list is sponsored by WebNet Technologies.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
A list archive is at: http://www.findmail.com/listsaver/tcldallas/

Reply via email to