LassoScript Utility
Basics Browse Detail


Tag Link [File->Write] Category File
Type Member Source Available Yes
Support Preferred Version 7.0
Change Unchanged Data Source Any
Output Type None Security File
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0


Writes string data to a file. Requires the text string to write as a parameter. Two optional comma-delimited interger parameters may also be included, which specified which characters in the provided text string or string variable to write to the file.


[File Variable->(Write: 'This is some text')]

[File Variable->(Write: 'This is some text', Integer, Integer)]


Required Parameters
'String' String value to write to the file.


To write text to a file:

Use the [File->Write] tag. The file object should be cast with an open mode that permits writing. The example below adds the text This is some text after the fifth line of the file.

[Var:'File'=(File: 'myfile.txt', File_OpenWrite, File_ModeLine)]
[$File->(SetPosition: 5)]
[$File->(Write:'this is some text')]

To write part of a string variable to a file:

Use the [File->Write] tag with the optional size and offset integer parameters. This is useful for truncating part of an existing string variable on-the-fly before writing it to the file. The example below adds the text five to the file out of a pre-defined string variable with a value of There are five elements.

[Var:'Text'='There are five elements']
[Var:'File'=(File: 'myfile.txt', File_OpenWrite, File_ModeLine)]
[$File->(Write: $Text, 4, 10)]