Function latin::file::append_line [] [src]

pub fn append_line<P: AsRef<Path>, C: AsRef<[u8]>>(
    path: P,
    contents: C
) -> IoResult<()>

Appends some contents followed by a newline to the file at path.

The newline seperator will vary depending on operating system. Windows: "\r\n" All other: "\n"

If the file at path does not exist, it will be created. Otherwise, the file will be completely overwritten.

// append a line followed by a newline
latin::file::append_line("./foo.txt", "appended line");
// not sure why you'd want this, but this works too
latin::file::append_line("./foo.txt", &[10u8, 5u8]);