# write_lines

Definition: | integer res = write_lines(object filename, sequence lines)
Description: | Overwrite the contents of a text file from a sequence of lines.
pwa/p2js: | Not supported.
Comments: | The filename parameter can be a string, in which case the file is opened and closed by this routine, or an integer from a previous call to open(), in which case it is not closed by this routine, and will/may append content, depending on the mode with which it was opened and any intervening activity, such as puts() or seek(). The lines parameter can be a single string or a sequence of strings. If the file cannot be opened, -1 is returned, with +1 indicating success. Whereas Euphoria may sometimes and_bits(char,#FF), this rejects any lines[i] which is not a string (unless lines itself is a string), and makes no attempt (not even implicitly) to coerce a dword-sequence back into a string, either top-level or nested - should you need that you will have to make a copy and relax the interval validation. Whilst perfectly suited to writing UTF-8 files, this routine is not capable of writing UTF-16 or UTF-32, except perhaps as carefully pre-composed byte-strings (including any required BOM header).
Implementation: | See builtins\pfile.e (an autoinclude) for details of the actual implementation.
See Also: | open, read_lines