in reply to file truncate not working on 128GB file in Windows

If $Config{archname} is not MSWin32-x64 then you cannot do anything on files greater than 4GB.
  • Comment on Re: file truncate not working on 128GB file in Windows

Replies are listed 'Best First'.
Re^2: file truncate not working on 128GB file in Windows
by NERDVANA (Priest) on Feb 08, 2024 at 18:08 UTC
    Are you sure about that? Win32 API for 32-bit hosts includes functions for working with 64 bit file offsets, and 32-bit perl can be compiled with 64-bit IV. I would think the config to check would be $Config{ivsize}. Well, unless you know for sure that some detail of 32-bit windows perl builds prevented 64-bit file offsets.
      Are you sure about that?

      Good question.
      I readily accepted sectokia's assertion, but I don't really know.

      One can (and I routinely do) build "MSWin32-x86" perls on my 64-bit Windows 11 box.
      Would the same limitation apply to those perls ?
      Some of those 32-bit builds have ivsize of 4, others have ivsize of 8, but they all have ptrsize of only 4.

      Cheers,
      Rob
Re^2: file truncate not working on 128GB file in Windows
by harangzsolt33 (Deacon) on Feb 11, 2024 at 21:26 UTC
    Well, TinyPerl 5.8 says "MSWin32-x86-multi-thread"

    and I can confirm that it can open a 7GB file and seek way past the 4GB mark and correctly read from the file using the sysopen, sysseek, and sysread functions.

    The 4GB limitation applies to DOS, because the DOS system calls limit the file pointer to 4GB. So, you can't seek past the 4GB mark with programs written for DOS mode. EDIT: Actually, I tested Perl 5.004, and it won't even open the file that is larger than 4GB. But that's ancient technology right there.

      For the sake of research, can you confirm the $Config{ivsize} of your tinyperl?
        I'm not at my computer right now, but does ivsize refer to the pointer size? I use WinXP Pro SP2 32-bit, so all my Windows programs are 32 bit.