Pádraig Brady wrote:
It states that text files can have zero or more lines, implying that the trailing new line is optional.
I think Eric's right here; if the file is nonempty, a trailing newline is required. I'm old enough to remember when text files were not allowed to be empty (!). Totally bizarre, but that's the way POSIX was until 2008. Before that, every text file had to end with a newline byte. See: http://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_392
