Hello,
There is something I don't get with mapped_file from the IOStreams
library. Here is an example:
// Code snippet
#include <iostream>
#include
#include
using namespace boost::iostreams;
int main(int argc, char **argv)
{
if (argc != 2) return 1;
try
{
stream out;
mapped_file_params p(argv[1]);
p.new_file_size = 1024 * sizeof (char);
out.open(mapped_file_sink(p));
}
catch (const std::exception &e)
{
std::cout << e.what() << std::endl;
return 2;
}
return 0;
}
// Code snippet
When compiled, the execution goes like:
c:\>test_shmem somefile
c:\>test_shmem somefile
failed setting file size: The handle is invalid.
I tried without the new_file_size, I tried with a mapped_file... Is
there something I don't get? Why are we not able to open a file that
already exist?
Thanks for your help.
JD