[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: io:lines() and \0
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 17 Feb 2014 14:10:28 -0300
> I just noticed that io:lines() does not cope with \0 in the lines, and thus just returns truncated lines (lua-5.2.3, but legacy 5.1 likewise).
> May I suggest replacing the call to fgets in src/liolib.c so that we can read lines with \0 data?
At least in Mac OS X and Linux fgets works just fine: it reads bytes
until it sees \n, as promised in its man page. Unfortunately, fgets does
not tell you how many bytes it has read and you're left with having to
call strlen to find this out. I guess we could avoid strlen and use
How did you propose to replace fgets?