Commit 9e37f5ce authored by Gabi Melman's avatar Gabi Melman Committed by GitHub

Merge pull request #285 from azadkuh/issue280

update os.h to fix filesize() on older win32
parents 1f1f6a5f 811eeef7
......@@ -31,6 +31,7 @@
#endif
#include <sys/types.h>
#include <io.h>
#elif __linux__
......@@ -204,9 +205,9 @@ inline size_t filesize(FILE *f)
return st.st_size;
#else //windows 32 bits
struct _stat st;
if (_fstat(fd, &st) == 0)
return st.st_size;
long ret = _filelength(fd);
if (ret >= 0)
return static_cast<size_t>(ret);
#endif
#else // unix
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment