[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: io:lines() and \0
- From: Enrico Colombini <erix@...>
- Date: Wed, 19 Feb 2014 14:47:32 +0100
On 19/02/2014 14.11, René Rebe wrote:
A loop over the lines of any file should reproduce the file, given a reasonable
modern, C library, especially when the file is opened in binary mode.
I may be a bit repetitive here, but a binary file by definition has no
lines and should not be read with text functions such as gets() that are
only designed for text files.
As has been noted, text functions (regardless of what their behaviour on
observed systems may be) only guarantee that printable characters,
leading spaces and the few control characters listed by the standard are
preserved: the printable information.
Of course, an extension library could offer an iterator to read a binary
file as a sequence of byte blocks separated by one or more given
delimiters, but that is a completely different matter.