Skip to content

dos_writetextfile

Dale Fugier edited this page Jul 1, 2026 · 1 revision

Writes a list of strings to a text file. ANSI, UTF-8 and Unicode encoded text files are supported.

Syntax

(dos_writetextfile [filename strings [append [encoding]])

Parameters

filename

The name of the text file to write

strings

The array of strings to write.

append

If omitted or nil, the file will be overwritten if it already exists. If T, then the will be appended to if it already exists.

encoding

The text file encoding, where: 0 = ANSI Encoding (default), 1 = UTF-8 Encoding, and 2 = Unicode Encoding.

Returns

The number of lines written to the text file if successful.

nil on error.

Example

Command: (setq strings (list "The quick brown fox" "jumped over the lazy dog."))
("The quick brown fox" "jumped over the lazy dog.")

Command: (dos_writetextfile "test.txt" strings)
2

Clone this wiki locally