several questions about Tcl
dear all , here I have several questions about Tcl
1 : I have gotten a line including some node tags , have can I set each strings to
node tags ?
for example
set fd [open "3.tcl" r]
:
:
:
set Value [string range $line [expr $equalpos + 1] [expr $commentpos -1]]
puts $Value
now I get :
* 1 25 360 2123 20120 ....
how can I set the" 1, 25, 360,2123, 20120 ... " these numbers to the node tags ?
2 : how can I add "#" to an assigned position ?for example the head of a line in a tcl by using tcl command ?
for example :
element 1 2 3 4 5 6 7 8 5 .....
to---------
# element 1 2 3 4 5 6 7 8 5 .....
thanks!
several questions about Tcl
Moderators: silvia, selimgunay, Moderators
who can tell me what's wrong with the foolowing scripts&
set tags1 {77 78 81 80 86 87 90 89
82 83 86 85 91 92 95 94
83 84 87 86 92 93 96 95
85 86 89 88 94 95 98 97
86 87 90 89 95 96 99 98 }
set tags2 {77 78 81 80 86 87 90 89
82 }
set unkillednum [llength $tags2 ]
for {set i 0} {$i < $unkillednum } {incr i} {
set q [lindex $tags2 $i ]
puts $q
lsearch $tags1 $q
}
82 83 86 85 91 92 95 94
83 84 87 86 92 93 96 95
85 86 89 88 94 95 98 97
86 87 90 89 95 96 99 98 }
set tags2 {77 78 81 80 86 87 90 89
82 }
set unkillednum [llength $tags2 ]
for {set i 0} {$i < $unkillednum } {incr i} {
set q [lindex $tags2 $i ]
puts $q
lsearch $tags1 $q
}