Default value for console input ! please help

Default value for console input ! please help

Post by Deni » Fri, 05 Dec 2003 03:58:31


Hi,
I need to do read a value from user but also give him/her a default value
which they can edit ( all in text mode, no windows) how can I do that?
For example

Enter number 1 - 1000 : 55_

55 appears
user can delete part by backspace or type extra digits
or just press enter to submit.

Please help!
very urgent !
Thank you so much !

Den
 
 
 

Default value for console input ! please help

Post by karl » Sun, 14 Dec 2003 05:45:40


I don't think it's possible to generate output that can be overwritten
and reread this way. I think your best bet is to just check to see if
the user pressed enter without typing anything, and use the default
value in that case. Your prompt could be like this:

Enter number 1 - 1000 (55): _