#include <boost/interprocess/file_mapping.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <boost/interprocess/sync/sharable_lock.hpp>
using namespace boost::interprocess;
int main()
{
file_mapping m_file("text.txt", read_write);
mapped_region region(m_file, read_write);
void * addr = region.get_address();
std::size_t size = region.get_size();
char *mem = static_cast<char*>(addr);
std::cout << size << std::endl;
//向文件中写
double cd = 100.99;
memcpy(mem, &cd, sizeof(double));
// 从文件中读
double cc;
memcpy(&cc, mem, sizeof(double));
std::cout << cc << std::endl;
return 0;
}