0
如果用戶通過對話框單擊是,我想完成一個現有的文本文件。 實際的代碼覆蓋現有的文件!Tcl寫入最後一行的文本文件
set answer [tk_messageBox -message "file already exists, do you want to add more?" -title "Configuration Check" -type yesno -parent .example1]
case $answer {
yes {
set fid [open $::filename2/testfile.txt w]
puts $fid "last row"
close $fid
是否有任何想法去到最後一個現有的行和完成文件?
問候
謝謝先生! – ManInTheMiddle
在追加模式下,您可以在寫入時僅追加(對日誌非常有用)。某些打開事物的方法需要使用POSIX樣式模式。 –