Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to a text file

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I know this has been answered before but, what I'm trying to do is a little funny (well to me the newbie tcl coder!).

This is what I've got:
set loc d:/

button .framemid.ok -text OK -command { .framelower.result config -text [.framemid.location get]
set output [open hds w]
puts $output $loc
close $output}

When I run this I get the error:
can't read "output" no such variable

Any ideas what I'm doing wrong?

Thanks
 
Looks like the
Code:
[open hds w]
got an error. Maybe the file "hds" can't be created for some rights reason.
If this is true, you should get an error. I suppose that you can't see it because your script is registered inside the button command.
To trap the generated error try to define a bgerror proc:
Code:
proc bgerror {msg} { tk_message -message $msg }
Good luck.

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top