text_file_write

text_file_write writes text into a file in ANSI - or Unicode format.

bool = text_file_write(ssFilename, ssText)
bool = text_file_write(ssFilename, ssText, ssEncoding)
bool = text_file_write(ssFilename, ssText, ssEncoding, ssNewline)

Return Value

Returns TRUE (1) if successful, FALSE (0) otherwise.

Parameters

ssFilename

ssFilename is the complete file name. If the file already exists the file will be overwritten.

ssText

ssText is the text.

ssEncoding

ssEncoding is one of the following strings:

Value Meaning
ansi default value
utf8bom UTF-8 with BOM (Byte Order Mark).
utf8 UTF-8 without BOM.
utf16le UTF-16 little endian without BOM.
utf16lebom UTF-16 little endian with BOM.
utf16 UTF-16 without BOM.
utf16bom UTF-16 with BOM.

The values are case insensitive and minus characters are ignored. UTF-16-LE is a valid value.

ssNewline

ssNewline is one of the following strings:

Value Meaning
“default” Default value (“crlf”)
“crlf” \x0d \x0a
“cr” \x0d
“lf” \x0a

Example

ssText = "[[This is
a text]]";
text_file_write("c:/test.txt", ssText, "ansi", "default")

History

Version Description
R2013.1 The parameter ssEncoding may contain - characters, e. g. utf-8.
5.0.0 New.

id-847459