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!

TCL ERROR

Status
Not open for further replies.

bebig

Technical User
Oct 21, 2004
111
US
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
}
 
Your script looks ok, assuming your file, test.txt, conforms to the implied format. Could you post the complete error message?

Bob Rashkin
rrashkin@csc.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top