Re: io:lines() and 0円
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: io:lines() and 0円
- From: Philipp Janda <siffiejoe@...>
- Date: 2014年2月21日 16:51:42 +0100
Am 21.02.2014 16:23 schröbte Javier Guerra Giraldez:
On Fri, Feb 21, 2014 at 10:14 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
For me, only text files have lines
i concur.
Me too, but the problem is that you can only find out if a file is a
text file when you have read it from beginning to end. "Garbage in,
garbage out" is ok for internal functions, but not for APIs exposed to
the end-user. And reading files is always exposed to the user of the
filesystem (with the possible exception of temp files).
i would even accept if io.lines() raised an error if called with a
file that wasn't opened in text mode.
`io.lines()` always opens the file in text mode, you probably meant
`file:write()`.
I wouldn't. I need binary streams for UTF-8, latin1, etc. (basically
everything except ASCII) ...
of course, i much prefer the contract to be clearly stated "due to the
underlying old C implementation, embedded control characters can make
it return wrong results. if you need to read binary data, use
file:read()"
Philipp
- References:
- Re: io:lines() and 0円, René Rebe
- Re: io:lines() and 0円, René Rebe
- Re: io:lines() and 0円, Sean Conner
- Re: io:lines() and 0円, Francisco Olarte
- Re: io:lines() and 0円, Enrico Colombini
- Re: io:lines() and 0円, Francisco Olarte
- Re: io:lines() and 0円, Sean Conner
- Re: io:lines() and 0円, Francisco Olarte
- Re: io:lines() and 0円, Sean Conner
- Re: io:lines() and 0円, Francisco Olarte
- Re: io:lines() and 0円, Roberto Ierusalimschy
- Re: io:lines() and 0円, René Rebe
- Re: io:lines() and 0円, steve donovan
- Re: io:lines() and 0円, René Rebe
- Re: io:lines() and 0円, Andrew Starks
- Re: io:lines() and 0円, Dirk Laurie
- Re: io:lines() and 0円, Javier Guerra Giraldez