updating oE write_lines

write_lines

include io.e 
namespace io 
public function write_lines(object file, sequence lines) 

write a sequence of lines to a file.

Parameters:
  1. file : an object, either a file path or the handle to an open file.
  2. lines : the sequence of lines to write
Returns:

An integer, 1 on success, -1 on failure.

Errors:

If puts cannot write some line of text, a runtime error will occur.

Comments:

If file was a sequence, the file will be closed on completion. Otherwise, it will remain open, but at end of file.

Whatever integer the lines in lines holds will be truncated to its 8 lowest bits so as to fall in the 0..255 range.

Example 1:
if write_lines("data.txt", {"This is important data", "Goodbye"}) != -1 then 
    puts(STDERR, "Failed to write data\n") 
end if 
See Also:

read_lines, write_file, puts

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu