hnzy666 2022-11-09 14:48:26
qt creator如何利用内存映射来打开大文件
...全文
148 1 打赏 收藏 举报
写回复
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复

QFile 打开,然后映射。下边是官方技术文档
uchar *QFileDevice::map(qint64 offset, qint64 size, QFileDevice::MemoryMapFlags flags = NoOptions)
Maps size bytes of the file into memory starting at offset. A file should be open for a map to succeed but the file does not need to stay open after the memory has been mapped. When the QFile is destroyed or a new file is opened with this object, any maps that have not been unmapped will automatically be unmapped.
The mapping will have the same open mode as the file (read and/or write), except when using MapPrivateOption, in which case it is always possible to write to the mapped memory.
Any mapping options can be passed through flags.
Returns a pointer to the memory or nullptr if there is an error.
See also unmap().

发帖
Qt

1.5w+

社区成员

Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
帖子事件
创建了帖子
2022-11-09 14:48
社区公告
暂无公告