lua-users home
lua-l archive

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


On Tue, Mar 20, 2012 at 21:17, Minh Ngo <mkngo87@gmail.com> wrote:
> Hello,
>
> I can't quite understand what some of the modes do for io.open as explained
> in 5.1 manual. Specifically, I'm not sure what "r+", "w+", and "a+" modes
> do.
> For "r+" and "w+", I'm not sure what the word update entails. "a+" mode
> sounds exactly the same as "a" mode to me,
>
> So from what I understand so far:
> "r"   --> read only, no writing allowed
> "w"  --> overwrite file
> "a"  --> write at the end of the file
> the rest --> ?

r+ is read/write without overwriting.
I think with a, you can't seek in the file, only write (append) to it,
whereas with a+ you can (but by default the write position is at the
end).

-- 
Sent from my toaster.