lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> 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
> iolib.c:read_line(). 

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.