4 Replies Latest reply on Mar 27, 2007 1:14 PM by quinibi



      I am trying to save in a variable a word read from a text file. The code I use is listed below, but It does not work, can anybody help me?
      objFileio=new xtra("fileio")
      objFileio.openfile(The moviePath&"id.txt",2)
      I have also tried with readFile()
        • 1. Re: fileio
          Level 7
          It's difficult to tell what's going wrong or where until you start some
          basic debugging. The following might get you started - look to your
          message window for output.
          objFileio=new xtra("fileio")
          put objFileio
          objFileio.openfile(The moviePath&"id.txt",2)
          put objFileio.status()
          put objFileio.status()
          put act
          objFileio = VOID
          • 2. Re: fileio
            quinibi Level 1
            The obtained sequence is:
            -- <Xtra child "fileio" 2 41ae684>
            -- 0
            -- -124
            -- <Void>

            It seems that I got an error after doing readFile(), -124, but I do not know what it means. I have been thinking that maybe I am trying to read before it is ready. Is there any Lingo Script function to wait sometime before executing readFile()?
            • 3. Re: fileio
              Level 7
              -124 translates to "File is opened write-only" so need to open it
              read-only (or read-write) (I can never remember what those numbers refer
              to, and it's always frustrating having to look them up):
              objFileio.openfile(The moviePath&"id.txt", 1)
              • 4. Re: fileio
                quinibi Level 1
                Thank you very much!!
                That was the problem, I had a confused manual in which 2 was supposed to be Read/write instead of 0...