I am trying to write code that is portable across Windows and Mac OS X. The problem I have is that I need to read and write large files over 4GB, so I need to use 64 bit versions of fseek() and ftell(). On Windows (using MinGW), I can use fseeko64() and ftello64(). However, these functions do not exist on Mac OS X. It uses ftell(), and I believe supports 64 bit files by default if using 64 bit variables to store file offsets (I am using int64_t).
Another problem is that MinGW doesn't like the %lld printf specifier. It wants %I64d instead. Is there a way I can change these based on a preprocessor statement? Something like this:
That doesn't work, but you see what I'm getting at.Code:#if defined(_WIN32) #define %lld %I64d #endif