我有以下代码将文件加载到boost mapped_region:
file_mapping fm(FilePath, read_only);
mapped_region region(fm, read_only);
char * const data = static_cast<char *>(region.get_address());
char*
指针,而是使用静态字符数组char c[x]
?答案 0 :(得分:1)
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];
}