【发布时间】:2014-12-06 06:14:34
【问题描述】:
我正在初始化 boost mapped_file_params,如下所示。
mapped_file_params param;
param.path = _fileName.c_str();
param.flags = mapped_file::readwrite;
int nGranularity = mapped_file::alignment();
//! must be in multiples of Granularity.
param.offset = 5*nGranularity;
当我打开具有文件大小的文件时,我得到一个 std::exception 读取“最多可以指定 'mode 和 'flags 之一”。我没有从 boost 的文档中填充模式,它说该模式已被弃用。建议进一步的新代码应该使用标志。
我的 boost 文件类型定义为
boost::iostreams::mapped_file _bioFile;
我已尝试使用打开文件
_bioFile.open(param, filesize);
提升 IO 文档:http://www.boost.org/doc/libs/1_57_0/libs/iostreams/doc/classes/mapped_file.html
我是不是错过了什么。
【问题讨论】:
标签: c++ boost memory-mapped-files