lua-users home
lua-l archive

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

Hi All,

I saw a discussion some time ago on making file seek/tell to work with
large (>2GB) files on Windows 32bit:

I used Roberto's suggestion, but modified it slightly as the linker
couldn't find fseeko and ftello (I replaced them with fseeko64 and

#if defined(liolib_c) && defined(__MINGW32__)
#include <sys/types.h>
#define l_fseek(f,o,w) fseeko64(f,o,w)
#define l_ftell(f) ftello64(f)
#define l_seeknum off_t

I compiled Lua 5.3.1 with mingw 4.8.1 and everything has been working
as expected, but I only tested it on one machine. Is it the right way
to apply this fix?

I initially was confused by the message from f:seek("end"), which
returned (on a large file):

nil    "Invalid argument"    22

f:seek("set", -1) returned the same result. I think it's a bit
misleading as there is nothing wrong with the arguments I passed.