Reading text files

David Squance squance at elkvalley.net
Sat Jul 10 16:09:36 EDT 2004


Dan,
Thanks for the reply.  I'm only attempting to read from a file, not write
to it, but is there a reason that doesn't work when the file is on a CD?
This is part of the script I'm using:

  set the itemDelimiter to "/"
  repeat
    answer file "Choose the team name:"
    if the result is "cancel" then exit mouseup
    put it into tfilename
    put the last item of it into teamname
  -- 'teamname' holds the file's name with no extension that's
obvious
   ,,,
    some stuff to determine the destination fld
   ,,,
    open file tfilename
    repeat for 200
      read from file tfilename until return

  etc.

It *is* working from the standalone, but not when all of it is on a CD.
I checked over the entry in the docs you mentioned, but there were no
obvious hints when 'answer file' is used--it's just referred to as a way
of finding the correct file path.  I wouldn't normally run it from a CD,
but I don't want to install it on the Windows computer I'm using for
testing, and if it won't work at home on my Mac, it won't likely work on
a PC.
Dave

>I'm not 100% sure what might be going on here. It's not clear what you
>mean when you say it doesn't work in a standalone.
>
>Two possible leads to follow based on my experience.
>
>First, if you're opening the files for reading and writing and they
>reside on a CD (locked media), there may be some strange interaction
>going on there.
>
>Second, file pathing is crucial and not always straightforward (at
>least I haven't found it to be so). Particularly when you bundle as a
>standalone and the text files are included in the bundle file pathing
>is not what you expect it to be from your IDE experience. There are
>some notes on this in the docs under "Why can't Revolution find a file
>I specified?" Note particularly the defaultFolder stuff.
>
>HTH
>
>Dan




More information about the use-livecode mailing list