In tcl, now I want to source a file with some arguments, for instance, source file arg1 arg2. I use a procedure like this
proc src {file args} {
set argv $::argv
set argc $::argc
set ::argv $args
set ::argc [llength $args]
set code [catch {uplevel [list source $file]} return]
set ::argv $argv
set ::argc $argc
return -code $code $return
}
If I do src file arg1 arg2, it works perfectly. However, I can only provide the arg1 and arg2 as one string, for instance: set string "arg1 arg2". Then my src proc will take this string as one argument. Is there any way to solve this problem?