0
我正在使用tcl的http包下載文件列表,並想知道處理中斷的最佳方式是什麼。眼下大綱我下載的程序是這樣的:在Tcl中處理下載中斷
proc downloadFiles {url_list folder_location} {
foreach {i} $url_list {
regsub {.*/(.*)$} $i {\1} $name
set out [open $folder_location/$name w+] //not worried about errors here
if {[catch {set token [http::geturl $i -channel $out]}]} {
puts "Could not download $i"
} else {
http::cleanup $token
puts "Downloaded $i"
}
close $out
}
}
我有問題,該生產線是catch語句:
catch {set token [http::geturl $i -channel $out]}
顯然,儘管我切斷了我的互聯網和停止下載一半catch語句仍然返回0表示錯誤。有沒有辦法解決這個問題?
謝謝,工作得很好。 – NorthGuard 2010-07-23 16:29:04