|
Boost Users : |
Subject: [Boost-users] [iostreams] mapped_file path issue
From: Alexandre (immarespond_at_[hidden])
Date: 2013-03-24 11:11:18
Hello,
After reading through all the documentation and examples I could read, I still can't get the following piece of code to work . I assume that when you pass a new_file_size and a path to the mapped_file_params class , it will then open the file at the location desired when I call the constructor of mapped_file with the mapped_file_params object in parameter.
But the only thing it does is to create a file with a weird name , like "%F8/134" in the project working directory, not where I told it to.
Maybe I'm wrong and one should create file before specifying it to the mapped_file? After reading the doc, I was under the assumption that it created a new file when you fill in the new_file_size param. and specifies the filename.
Anyone experienced this before? Any advice on how to resolve this?
Here's the code:
boost::iostreams::mapped_file_params param(filename); // filename is a std::string with the correct path
param.flags = boost::iostreams::mapped_file::mapmode::readwrite;
param.new_file_size = sizeNeeded; // sizeNeeded is the size of the data
param.length = sizeNeeded;
boost::iostreams::mapped_file fileMap(param); // at this point the file is created
Thanks for your time,
Alexandre
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net