3 Replies Latest reply on May 9, 2006 9:55 PM by HarryKris

    writing to a file

    HarryKris
      please help me , my application does a small survey. All it does is when ever a user answers a question i must update a flat file which contains the data as follows

      Answer1_A=1230
      Answer1_B=2211
      Answer1_c=1212

      Answer2_A=1230
      Answer2_B=2211
      Answer2_c=1212
      ;
      ;
      and so on...

      if the user choosen answer A for the question 1 then i must rewrite the data in the flat file as

      Answer1_A=1231
      Answer1_B=2211
      Answer1_c=1212

      Answer2_A=1230
      Answer2_B=2211
      Answer2_c=1212
      ;
      ;
      and so on...
        • 1. Re: writing to a file
          Level 7
          check in the documentation for the FileIO xtra included with Director

          HarryKris wrote:

          > please help me , my application does a small survey. All it does is when ever a
          > user answers a question i must update a flat file which contains the data as
          > follows
          >
          > Answer1_A=1230
          > Answer1_B=2211
          > Answer1_c=1212
          >
          > Answer2_A=1230
          > Answer2_B=2211
          > Answer2_c=1212
          > ;
          > ;
          > and so on...
          >
          > if the user choosen answer A for the question 1 then i must rewrite the data
          > in the flat file as
          >
          > Answer1_A=1231
          > Answer1_B=2211
          > Answer1_c=1212
          >
          > Answer2_A=1230
          > Answer2_B=2211
          > Answer2_c=1212
          > ;
          > ;
          > and so on...
          >
          >
          • 2. Re: writing to a file
            James Newton, ACP Level 3
            In the Message window, type:

            put xtra("fileio").interface()

            You will see a list of all the commands. To append to the end of a file, you need to:

            open the file
            find out how long it is
            use setPosition to set the write/read cursor at the end of the file
            write your new string
            close the file

            It's good practice to check the status of the xtra instance after each operation, just in case you try writing to a file for which you have read-only access, for example.
            • 3. Re: writing to a file
              HarryKris Level 1
              Thank you very much... i think this will solve my problem...