I noticed that you need to reverse the slashes, i.e., C:tempmsgcnt needs to be C:/temp/msgcnt/ in TCL.
Try this:
lappend msg_cntr_log $startdate
lappend msg_cntr_log $starttime
lappend msg_cntr_log $msg_cntr
set msg_cntr_log [join $msg_cntr_log t]
set file “C:/temp/msgcnt/msg_cntr.log”
set logfile [open $file a+]
puts $logfile $msg_cntr_log;flush $logfile
close $logfile
Hope this helps,
Robert Milfajt
Northwestern Medicine
Chicago, IL