"and.u" wrote:
> 
> How to limit string which return from IO::gets max length ?

One way is:

  inp = gets[0,length]

"[0,length]" truncates what gets assigned to inp, though before that
happens, IO::gets can invisibly generate a string of arbitrary length. 
I think from a security standpoint that isn't a problem, but maybe
somebody will correct me.

  Mark