Octave is using gnulib's "fseek" and "ftell" functions. A user reported that they have issues when using these functions with large files on Windows: https://savannah.gnu.org/bugs/index.php?66399
If I understand the code paths for Windows correctly, the issue might be caused by the fact that the "fseek" and "ftell" functions are forwarding to "_fseeki64" or "_ftelli64", respectively, if the size of the "off_t" type is smaller than 64-bit. They are forwarding to "fseek" and "ftell" otherwise. However, even if the "off_t" type is 64-bit (or larger), "fseek" and "ftell" still return "long" on Windows which is only 32-bit wide: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/ftell-ftelli64?view=msvc-170 The following change avoids the issue described in the above bug report for me. I don't know whether that change is correct though. Thank you, Markus diff --git a/lib/fseeko.c b/lib/fseeko.c index 2c3b053a3b..30f8f70afe 100644 --- a/lib/fseeko.c +++ b/lib/fseeko.c @@ -31,7 +31,7 @@ fseeko (FILE *fp, off_t offset, int whence) # undef fseek # define fseeko fseek #endif -#if _GL_WINDOWS_64_BIT_OFF_T +#if _WIN32 # undef fseeko # if HAVE__FSEEKI64 && HAVE_DECL__FSEEKI64 /* msvc, mingw since msvcrt8.0, mingw64 */ # define fseeko _fseeki64 diff --git a/lib/ftello.c b/lib/ftello.c index 88247bca8e..2f83c61c0e 100644 --- a/lib/ftello.c +++ b/lib/ftello.c @@ -34,7 +34,7 @@ ftello (FILE *fp) # undef ftell # define ftello ftell #endif -#if _GL_WINDOWS_64_BIT_OFF_T +#if _WIN32 # undef ftello # if HAVE__FTELLI64 /* msvc, mingw64 */ # define ftello _ftelli64