Creating, then writing to a text file?

Hi all,

A little confused by the procedure to create a file, then write variables to that text file. Code is below, the file soc1.sav does not exist yet:

#if DebugBuild f = getfolderitem("").Parent.Child("soc1.sav") #else f = getfolderItem("soc1.sav") #endif t = textoutputstream.create(f) t.WriteLine arm(1) t.WriteLine arm(2) t.WriteLine arm(3)

I get error in the 6th line - Type Mismatch error: Expected Textinputstream, but got Textoutputstream.

How do I code the above to create the file, then write the variables to it? Thanks!

You have dimensioned t to be a TextInputStream instead of a Textoutputstream.

D’oh! I did dim it as that earlier in the procedure. But will the code above create the file if it does not exist already?

Yes. It will create the file. It will replace it if it already exists.