Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: Thodd
  • Order by date
  1. Thodd

    lsort

    that's it! thanks a lot
  2. Thodd

    lsort

    Hello, I have a list that I want to sort, but I can't get it right. The pckt-array has a timestamp and a value on each line and is sorted by the timestamp. set pcktlst "" foreach {name value} [array get pckt] { lappend pcktlst $name $value } set pcktlst [lsort -integer -index 0 $pcktlst] #now...
  3. Thodd

    return boolean value

    Hi, I'm trying to get a boolean value from a procedure, so I can use it for an if-loop: proc program { $ns at $now getbool //ns runs the proc @ a certain time if {$bool == 1} { do something... } else { do something else... } } proc getbool { set bool 0 set req [expr $x - $y] if {$req ==...
  4. Thodd

    procedure calls

    Is Ulis's solution a lot faster, instead of using "eval"?
  5. Thodd

    arrays

    that did the trick! many thanks
  6. Thodd

    arrays

    Does anybody know how this can be solved? I don't see what's wrong here. :s for {set i 1} {$i <= 10} {incr i} { set file "file" append file $i ".tr" set chan [open $file] set lineNumber 0 set tmlst "" puts "Reads file $i ..." while {[gets $chan line] >= 0} { scan $line "%f" time lappend tmlst...
  7. Thodd

    parameter passing

    hey, thanks a lot!
  8. Thodd

    parameter passing

    Does anybody know how I can pass a value from a variable? for {set i 0} {$i < 3} {incr i} { if {$i != 0} { "BGP {$i}" } } proc BGP {x} { puts $x } my compiler says "BGP {$i}" is an invalid command... what is wrong? thx
  9. Thodd

    arrays

    ok but now there's an error: list must have an even number of elements while executing "array set $timearray $tmlst"
  10. Thodd

    arrays

    thx, so how can I grow those arrays?
  11. Thodd

    arrays

    ok I changed my code a little bit. For each file I'm reading it needs to store the time stamps in an array. I do it like this: for {set i 1} {$i <= 10} {incr i} { set file "file" append file $i ".tr" set chan [open $file] set lineNumber 0 set timearray "time" append timearray $i array set...
  12. Thodd

    arrays

    time should not be a variable, but an array, like: time1() time2() ... the values of those arrays are the timestamps (which are read before from the files). I like to print some values of those arrays. So I tried the following, before the for-loop: array set time but that doesn't work either.
  13. Thodd

    arrays

    I have 10 files which contain many lines with timestamps. Those timestamps are read and put in arrays beforehand in while-loops like: set chan [open "file1.tr"] set lineNumber 0 while {[gets $chan line] >= 0} { scan $line "%f" time1($lineNumber) $ns at $time1($lineNumber) "do something" incr...
  14. Thodd

    procedure calls

    Ok thx, it works!
  15. Thodd

    procedure calls

    Hi, I'm trying to call serveral procedures in a for-loop, but each cycle of the loop calls another procedure (named procedure0, procedure1,...), like this: for {set x 0} {$x < 10} {incr x} { puts "loopcount [expr $x + 1]" $ns at $x "procedureX" } Does someone know how I can do this? thx
  16. Thodd

    constructing array-variables

    I'm sorry, my mistake, I do have several files: for {set i 1} {$i <= 3} {incr i} { set filename "file" append filename $i ".tr" .... set chan [open $filename] set lineNumber 0 while {[gets $chan line] >= 0} { ... } close $chan } puts "$time2(50) = time value on line 50" So I need to open...
  17. Thodd

    constructing array-variables

    Thx for your advice! $ns isn't so important here, it's just a variable for my NS-2. It calls a procedure at some time. But I have another problem now. file.tr consists of lines with those time value. So I'm trying to print some of those values on screen afterwards. My code looks like: for {set...
  18. Thodd

    constructing array-variables

    I made a mistake with the html-tags, my code looks like: for {set i 1} {$i <= 3} {incr i} { set chan [open "file.tr"] set lineNumber 0 while {[gets $chan line] >= 0} { scan $line "%f" time1($lineNumber) $ns at $time1($lineNumber) "procedure" incr lineNumber } close $chan }
  19. Thodd

    constructing array-variables

    Hi, I have some probs with constructing array-variables in a for-loop. My code looks like this: for {set i 1} {$i <= 3} {incr i} { set chan [open "file.tr"] set lineNumber 0 while {[gets $chan line] >= 0} { scan $line "%f" time1b($lineNumber) $ns at $time1($lineNumber) "procedure" incr...
  20. Thodd

    executing tcl-file with arguments

    hey, thx! Now it works ;)

Part and Inventory Search

Back
Top