writing new line to text file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • gnetcanada
    Indigo Rose Customer
    • May 2003
    • 83

    writing new line to text file

    Hi guys,

    I have a form, when the user submits i want to write the line to the text file, but append not overwrite the data, however i want it appended on the next line.

    Current text file:
    my;name;is

    After adding i want:
    my;name;is
    new;name;is

    NOT
    my;name;isnew;name;is

    I assume i use the string append, but what character do i append to put the data on the nextline?

    Shawn
  • Corey
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9745

    #2
    Hi. The TextFile.WriteFromString() action has an append option, would this be better suited to this task or am I misunderstanding?

    Corey Milner
    Creative Director, Indigo Rose Software

    Comment

    • gnetcanada
      Indigo Rose Customer
      • May 2003
      • 83

      #3
      hi corey,

      yeah thats what im using, but it appends to the text, not a new line, do you know what im saying

      existing text

      once i append "newtext"

      this is what i get:
      existing textnewtext

      this is what i want
      existing text
      new text

      Comment

      • Corey
        Indigo Rose Staff Alumni
        • Aug 2002
        • 9745

        #4
        Hi. just add \r\n to your text... i.e.:

        "\r\n\Line to write to file here"

        That creates a new line in the text file...

        Corey Milner
        Creative Director, Indigo Rose Software

        Comment

        • gnetcanada
          Indigo Rose Customer
          • May 2003
          • 83

          #5
          not working corey. Give me an error if i do 'r\n\' or "r\n\"

          in1 = Input.GetText("Input1");
          in2 = Input.GetText("Input2");
          in3 = Input.GetText("Input3");
          in4 = Input.GetText("Input4");
          result = String.Concat(in1, ";");
          result2 = String.Concat(result, in2);
          result = String.Concat(result2, ";");
          result3 = String.Concat(result, in3);
          result = String.Concat(result3, ";");
          result4 = String.Concat(result, in4);
          TextFile.WriteFromString("output.txt", result4, true);
          TextFile.WriteFromString("output.txt", 'r\n\', true);

          Error Detail: [unfinished string near `<eof>'] in [TextFile.WriteFromString("output.txt", 'r\n\', true);]

          Comment

          • gnetcanada
            Indigo Rose Customer
            • May 2003
            • 83

            #6
            nevermind i got it, thanks man

            Comment

            • Corey
              Indigo Rose Staff Alumni
              • Aug 2002
              • 9745

              #7
              NP. :

              Corey Milner
              Creative Director, Indigo Rose Software

              Comment

              Working...
              X