| ECS-L Home Automation and Security Archives |
| Subject: From: Date: | RE: [ECS] Reading a text file into a number peter kraus Wed, 8 Mar 2000 06:47:30 -0500 |
some adjustment: define the input_char as type character define the cur_temp as type file pointing to cur_temp.txt ;check the __path__ to the file above in your item def define input_string as type text do number-a set 0 this was previously missing >>> do cur_temp set rewind ;you may not need the line above but is probably worth have to ensure reading from the begining this was previously missing >>> do input_char set cur_temp while input_char is not none if input_char is GE 0 and input_char is LE 9 and number-a is not 0 then number-a multiple 10 if input_char is 1 then number-a add 1 else if input_char is 2 then number-a add 2 else if input_char is 3 then number-a add 3 else if input_char is 4 then number-a add 4 else if input_char is 5 then number-a add 5 else if input_char is 6 then number-a add 6 else if input_char is 7 then number-a add 7 else if input_char is 8 then number-a add 8 else if input_char is 9 then number-a add 9 moved from top to bottom>>> do input_char set cur_temp endwhile do cur_temp# set number-a > -----Original Message----- > From: A.J. Griglak [mailto:aj@griglak.com] > Sent: Tuesday, March 07, 2000 11:13 PM > To: ecs-list@netbloc.com > Subject: RE: [ECS] Reading a text file into a number > > > OK... I've finally got around to trying this out. On my system, it throws > everything into an endless loop. It seems that input-char is always > <nul>... Does this mean that it's not actually reading the text file? > > -=A.J. > > -----Original Message----- > From: peter kraus [mailto:pkraus@optonline.net] > Sent: Sunday, March 05, 2000 5:37 AM > To: ecs-list@netbloc.com > Subject: RE: [ECS] Reading a text file into a number > > > try this: > > define the input_char as type character > define the cur_temp as type file pointing to cur_temp.txt > define input_string as type text > > do number-a set 0 > while input_char is not none > do input_char set cur_temp > if input_char is GE 0 > and input_char is LE 9 > and number-a is not 0 > then number-a multiple 10 > if input_char is 1 > then number-a add 1 > else if input_char is 2 > then number-a add 2 > else if input_char is 3 > then number-a add 3 > else if input_char is 4 > then number-a add 4 > else if input_char is 5 > then number-a add 5 > else if input_char is 6 > then number-a add 6 > else if input_char is 7 > then number-a add 7 > else if input_char is 8 > then number-a add 8 > else if input_char is 9 > then number-a add 9 > endwhile > do cur_temp# set number-a > > >