text_file_write¶
text_file_write writes text into a file using a given character encoding and newline 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
ANSI
utf8
UTF-8 (default)
utf8bom
UTF-8 with BOM (Byte Order Mark)
utf16
UTF-16
utf16le
UTF-16 little endian without BOM
utf16lebom
UTF-16 little endian with 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, "utf8", "default")
History
Version |
Description |
---|---|
R2024.3 |
The default value for ssEncoding is now in all cases |
R2013.1 |
The parameter ssEncoding may contain |
5.0.0 |
New. |
See also
id-847459