[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: io.lines() behaviour on \0 characters
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 28 Oct 2009 11:22:58 -0200
> I'm trying to use io.lines() to read lines from a file which contains \0
> characters. This seems to fail, probably because of the fgets() used in
Exactly. fgets does not report the length of the string read and so we're
forced to use strlen, which of course stops at any embedded \0.
fgets does read past \0 until it finds \n, at least in Linux, but the
the standard probably says that files containing \0 are not text files.