3 Replies Latest reply on Nov 25, 2008 2:38 PM by Newsgroup_User

    save to text file

      Hi good day I'm creating a quiz but I would like to know how to save the quiz results i.e from a variable, to a text or excel file. Thanks in advance.
        • 1. Re: save to text file
          Level 7
          There are a number of xtras that will allow you to write text to a text
          file. FileIO comes with Director and is free. See the help file for
          examples and usage. There are easier ways using other xtras, like
          BuddyAPI's baReadIni() and baWriteIni() which allow you to read/write to
          an ini file in standard ini format... or propsave or vList to simply
          write your list straight to file.
          • 2. Re: save to text file
            Below is the exact function that will do what you want.

            on EXTERNAL_writeData pPath, pData

            -- pPath [STR] pass the path including the name of the file
            -- pData [STR] the string that you wish to write
            pFile = new(xtra "fileio")
            if NOT objectP(pFile) then return -1

            createFile(pFile, pPath)
            openFile(pFile, pPath, 2)

            writeString(pFile, string(pData)) -- write a null-terminated string to the file


            return 0

            • 3. Re: save to text file
              Level 7
              > Below is the exact function that will do what you want.

              Except there is no error checking done, and no provision for the case
              when the file might already exist