I have a question.
when I run my program, I got error.
error happens when I add this.
--> set endTimeHour [expr ($startTimeHour + $runTimeHour)]
It says "missing while exc...."
please help me what is wrong ..
thank you
---------here is my code-----------
set readFile [open "test.txt" "r"]
gets $readFile line
# loop for each line in the file
while {![eof $readFile]} {
set lineList [split $line ,]
set lineLen [llength $lineList]
set lenStartTime [expr {$lineLen - 1}]
set lenRunTime [expr {$lineLen - 3}]
set houseNum [lindex $lineList 2]
set startTime [lindex $lineList $lenStartTime]
set splitStartTime [split $startTime :]
set startTimeHour [lindex $splitStartTime 0]
set startTimeMin [lindex $splitStartTime 1]
set runTime [lindex $lineList $lenRunTime]
set runTimeMin [expr int(fmod($runTime,60))]
set runTimeHour [expr int($runTime/60)]
# EndTime = Start Time + Run Time
#here is error..
set endTimeHour [expr ($startTimeHour + $runTimeHour)]
puts $endTimeHour
# read the next line
gets $readFile line
}
when I run my program, I got error.
error happens when I add this.
--> set endTimeHour [expr ($startTimeHour + $runTimeHour)]
It says "missing while exc...."
please help me what is wrong ..
thank you
---------here is my code-----------
set readFile [open "test.txt" "r"]
gets $readFile line
# loop for each line in the file
while {![eof $readFile]} {
set lineList [split $line ,]
set lineLen [llength $lineList]
set lenStartTime [expr {$lineLen - 1}]
set lenRunTime [expr {$lineLen - 3}]
set houseNum [lindex $lineList 2]
set startTime [lindex $lineList $lenStartTime]
set splitStartTime [split $startTime :]
set startTimeHour [lindex $splitStartTime 0]
set startTimeMin [lindex $splitStartTime 1]
set runTime [lindex $lineList $lenRunTime]
set runTimeMin [expr int(fmod($runTime,60))]
set runTimeHour [expr int($runTime/60)]
# EndTime = Start Time + Run Time
#here is error..
set endTimeHour [expr ($startTimeHour + $runTimeHour)]
puts $endTimeHour
# read the next line
gets $readFile line
}