1 Reply Latest reply on Oct 27, 2006 5:20 AM by Newsgroup_User

    Read from a text file

    Level 7
      Hello:
      I need to control if any change has done in a text file. So, it can be to
      read the file in a infinite loop and when a change is done, write this
      change in a text field?
      Can you tell me how to do this?
      thanks a lot.


        • 1. Re: Read from a text file
          Level 7

          Hi Anne,

          I'd go with reading the modification date of the file with an Xtra
          (budApi or FileXtra4) and if modification date is different from the
          last time you read the file, read it again.
          This way you don't need to open the file to check it's content. However,
          I think the most accurate those Xtras are is seconds. If so, twoo
          changes to the same file in one second would not register.

          in pseudo code:

          in initialization:

          read file, fill field member
          read and store modification data


          in loop:
          on exitFrame me (or some timeout eventhandler)

          read modification date
          if different from previously stored
          read file, fill field member
          read and store modification date
          end if

          end


          Hope this helps
          Manno

          Anne wrote:
          > Hello:
          > I need to control if any change has done in a text file. So, it can be to
          > read the file in a infinite loop and when a change is done, write this
          > change in a text field?
          > Can you tell me how to do this?
          > thanks a lot.
          >
          >

          --
          ----------
          Manno Bult
          manno@xs4all.nl