繁体   English   中英

遍历boostedapped_region /内存映射文件?

[英]Iterate through boost mapped_region/memory-mapped file?

我有以下代码将文件加载到增强的mapping_region中:

file_mapping fm(FilePath, read_only);
mapped_region region(fm, read_only);
char * const data = static_cast<char *>(region.get_address());
  • 我将如何逐个字符地遍历获得的数据?
  • 有什么办法可以修改上面的代码,所以我不使用char*指针,而是使用静态char数组char c[x]
file_mapping fm(FilePath, read_only);
mapped_region region(fm, read_only);
char * const data = reinterpret_cast<char*>(region.get_address());

// Iterate through the data obtained, character (c) by character.
for(std::size_t n = 0; n < region.get_size(); ++n)
{
      char c = data[n];
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM