提升内存映射文件:读写访问
Boost Memory Mapped File : Read-Write Access
我正在初始化提升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 显示"最多可以指定一个'模式和'标志"。我没有从 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
我错过了什么吗?
对于那些想要答案的人,我能够用这段代码解决这个问题。
_bioFile.open(_fileName.c_str(), std::ios_base::in | std::ios_base::out, filesize);
相关文章:
- Linux读,写Arduino串行
- 多线程一读一写time_t
- 将Linux打开,读,写,关闭功能以在Windows上工作
- 抛出例外:写违规访问.素数数组
- C++:重载 [ ] 运算符以进行读写访问
- 如果从其他线程访问(读/写)src缓冲区,是否有可能从memcpy获得访问冲突
- 如何使用std::lock_guard锁定对std::map的读写访问
- 单读多写器,带pthreads和锁,不带boost
- 如何从更基本的同步原语中创建多读/单写锁
- 如何使用 Windows API 正确检查对文件的有效读/写访问
- 对共享数据的线程安全访问 - 读/写实际发生,不会发生重新排序
- Q_PROPERTY参数化读写访问器
- 提升内存映射文件:读写访问
- 为银行项目计算读入/写出的问题
- 重构来自/到一个数据成员的读写访问器
- Linux下c++中的串口.可以读和写串行端口同时发生
- 在Windows+VisualC上是volatile读和写的原子
- GCC可以使用读-修改-写指令来更新易失性变量吗?
- 读(和写)Office文档自定义属性而不需要自动化
- vector多线程同步,一个读一个写:只在调整大小时锁定