写入大文件
我尝试写入一个大文件,但它似乎不适用于大于 2GB 的文件。 我尝试过使用 boost::iostreams::file_sink。 这只是升压流的限制吗? 还有其他方法可以在 Win64 和 win32 上写入大文件吗?
I try to write to a large file, but it seems like it does not work for files larger than 2GB.
I have tried with boost::iostreams::file_sink. Is this just a limit with the boost stream? Is there some other way I can write a large file on Win64 and win32?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这取决于:
这也可能帮助:http://www.boost。 org/doc/libs/1_37_0/libs/iostreams/doc/faq.html#offsets
This depends on:
This might also help: http://www.boost.org/doc/libs/1_37_0/libs/iostreams/doc/faq.html#offsets
在 Win32/64 中 ReadFile & WriteFile可以写入大于4GB的文件。 定位是通过 SetFilePointerEx。 同样,要获取您需要的文件大小 GetFileSizeEx 和不是基本的 GetFileSize。
In Win32/64 the ReadFile & WriteFile can write files larger than 4gb. The positioning is done via a 64bit _LARGE_INTEGER value in SetFilePointerEx. Likewise to get the file size you need GetFileSizeEx and not the basic GetFileSize.
在 NTFS 中,唯一真正的限制是卷的大小。 如果您想对此进行测试,可以使用命令行创建一个虚拟文件:
fsutil file createnew [文件名] [有效数据长度]
例如:
fsutil 文件 createnew TestFile.bin 65536000000
假设您有一个 NTFS 卷,这应该会创建一个 64GB 的文件。
In NTFS the only real limit is the size of the volume. If you want to test this out you can create a dummy file using the command-line:
fsutil file createnew [filename] [validdatalength]
Ex:
fsutil file createnew TestFile.bin 65536000000
That should create a 64GB file assuming you have an NTFS volume.