Friday 15 January 2010

tcl - How to write in file? -


I would like to write in the file like this:

  set FH [open $ tmpFileName W] Puts $ FH "set one [create_object]", puts $ $ FH "$ one proc1_inside_a" $ FH "$ a proc2_inside_a" $ FH off   

but its error message gets , Because a variable will be created when the tmpFileName file is executed. So I get an error like this:

  "a" can not be read: there is no such variable   

Do you help me in solving this can do? /p>

You just need to use a different quote mechanism to allow double quote commands and variable replacements . The braces will keep their content literally (stop the replacement) [FT [$ tmpFileName] Open $ FH {Set [create_object]} $ $ FH puts {$ a proc1_inside_a} $ FAH { $ a proc2_inside_a } About $ FH

Documentation is available:

No comments:

Post a Comment