问题
From ?truncate:
truncatetruncates a file opened for writing at its current position. It works only forfileconnections, and is not implemented on all platforms: on others (including Windows) it will not work for large (> 2Gb) files.
What is the cause of the 2Gb limit on Windows? Does it matter if it's 64bit Windows, or the file system is NTFS? Does the version of Windows matter (XP, 7, 8, 10)?
Is there a built-in R function or a function in some R package that achieves the same effect on Windows as truncate on Unix-like systems?
回答1:
- According to the source, a missing 64-bit version of the underlying
ftruncatesystem call. It seems that this issue can/will be resolved when the MinGW used to build R is updated. - No.
- No.
- The Win32 API is called SetEndOfFile, and a GitHub search for CRAN packages found eight hits. Good luck :-)
来源:https://stackoverflow.com/questions/32721789/limit-of-file-size-for-truncate-in-r