[英]Boost Memory Mapped File : Read-Write Access
我正在初始化升壓mapd_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::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);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.