我正在初始化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 read"最多可以指定一个'模式和'标志可以指定"。我没有从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
我错过了什么。
答案 0 :(得分:0)
对于那些想要答案的人,我能够解决这段代码的问题。
_bioFile.open(_fileName.c_str(), std::ios_base::in | std::ios_base::out, filesize);