2 Replies Latest reply on Oct 27, 2009 11:35 AM by Sean_Wilson

    FileIO Xtra

    Cherax79 Level 1

      Hello.

      I have problem with fileIO xtra:

       

      lets say I have a text file with:

      "abcdefghijklmnop"

      string

       

      Next I open that file (writeable)

      use writeString("abcde")

      and after close I get the same file, because xtra doesn't cut file length to new length.

       

      How to cut file length or clear file after I open it ?

        • 1. Re: FileIO Xtra
          Chunick Level 3

          I'm not sure what you're using fileIO for, but if it's to save stateful information about your application then you can probably use getPref() and setPref(), which would be simpler and solve your issue because the info is written over completely, if you so choose, when using setPref().

          • 2. Re: FileIO Xtra
            Sean_Wilson Adobe Community Professional

            When you open a file with FileIO and write a string, the write operation starts at the beginning by default. If there aren't enough characters in your string to overwrite anything that already exists then anything beyond the length of the string written isn't altered - as you observed. The solution is to delete the existing file and re-create it before writing.