Carsten2015
Carsten2015

Reputation: 47

output variables from TCL to a text file

I have three string variables in my TCL script now. Var1 Var2 and Var3.

I want to append them to the end of the output.txt with having blank space between them.

so the added line would be like this:

Var1 Var2 Var3

Upvotes: 0

Views: 1698

Answers (2)

Anand Satya
Anand Satya

Reputation: 81

set fp [open output.txt a]
puts $fp "${Var1} ${Var2} ${var3}"
close $fp

Upvotes: 1

glenn jackman
glenn jackman

Reputation: 246807

You would open the file in append mode. Then, write the string to the opened channel. You'll probably want the string to be a double-quoted string so variables can be substituted. Then, close the file.

Upvotes: 0

Related Questions