[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question about io.open modes
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 21 Mar 2012 14:12:22 -0300
> I wonder why the 5.2 manual doesn't say it's the same as fopen,
> though. Did they change/add some modes, or did they just not want to
> have to guarantee fopen's behaviour? Or is it a simple omission?
Lua 5.2 did not changed/add modes, but it may restrict some. ANSI C
demands that 'mode' have a valid, specific format, and some machines
may have real problems with invalid modes. So we added a verification
step in io.open. Now, even if your native C fopen accepts extensions
(e.g., Linux seems to accept 'wb+'), io.open does not accept them.
(Anyway, a reference to 'fopen' mentioning this caveat would be
useful.)
-- Roberto