PDA

View Full Version : writing new line to text file



gnetcanada
02-04-2004, 04:03 PM
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
02-04-2004, 04:12 PM
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 (http://www.indigorose.com)

gnetcanada
02-04-2004, 04:15 PM
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

Corey
02-04-2004, 04:18 PM
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 (http://www.indigorose.com)

gnetcanada
02-04-2004, 04:22 PM
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);]

gnetcanada
02-04-2004, 04:23 PM
nevermind i got it, thanks man

Corey
02-04-2004, 04:32 PM
NP. ::cool

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)