Purpose: discuss general guidelines for gathering input and then making use of it in Tcl. ---- A new user often finds s/he has a problem when dealing with user input. Sometimes, the problem is a file name with a space in it. Sometimes, the problem is a string with special characters like [[ or $ . On this page, please add notes to help a new programmer avoid these problems. ---- One important thing is to keep the ''type'' of the input string in mind as you code. While Tcl has the reputation of '''everything is a string''', not every command expects all its arguments to be arbitrary strings. In the most obvious example, Tcl input or output commands which require a file handle expects that argument to be a string returned from an open type command. Just handing some arbitrary string is very likely not going to work. Similarly, handing an arbitrary string to a command which expects an argument in a [list] format may very well not work either. [[Perhaps a real example of this will eventually surface, replacing this commenet, since my last attempt failed so miserably...]] ---- 02 Sept 2003 [Mike Tuxford]: Perhaps your mention of showing an example would indeed help. I am confused about what you mean by getting Tcl user input. If this means using an event handler to get [stdin] input then the braces, brackets, semi-colons will all be escaped properly in the 'string' and there is no danger of the user executing something that way. User input of filenames or paths can be tested using the various [file] options, etc. You touch on many issues that may have no generic answer but rather answers for specific cases. ---- [Category Tutorial] | [Category Security]