Write variable to file in tcl
# create some data set data "This is some test data.\n" # pick a filename - if you don't include a path, # it will be saved in the current directory set filename "test.txt" # open the filename for writing set fileId [open $filename "w"] # send the data to the file - # omitting '-nonewline' will result in an extra newline # at the end of the file puts -nonewline $fileId $data # close the file, ensuring the data is written out before you continue # with processing. close $fileId
Recent Comments