lua-users home
lua-l archive

Re: How to change io::f_seek to use 64 bit numbers

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


On 2008年10月01日 12:00:33 +0300, Shmuel Zeigerman <shmuz@013net.net> wrote:
Todor Totev wrote:
I'd like to use (platform specific) fseek with 64-bit file offsets inside io lib f_seek function.
But it gets the lua number with luaL_optlong which truncates it to long.
What do you suggest me to fix it?
Either patch Lua with your platform-specific fseek, or write a library.
Use luaL_optnumber rather than luaL_optlong, cast it to whatever is a 64-bit integer type on your platform, then you'll be able to get/set offsets up to 2^53 bytes (assuming lua_Number is double).
luaL_optnumber is what I need, thank you very much.

AltStyle によって変換されたページ (->オリジナル) /