Boost logo

Boost Users :

Subject: [Boost-users] mapped_file::close()
From: Millman, Mark (mark.millman_at_[hidden])
Date: 2013-07-04 16:27:50


In Windows using VisualStudio 10 I've created a mapped_file as

char * OpenRW(std::string filePath )
{
  <<fragment >>
  mfp = new boost::iostreams::mapped_file_params(filePath);
  mfp->mode = boost::iostreams::mapped_file::readwrite;
  mfp->new_file_size = size;
  mfp->offset = 0;
  mf = new boost::iostreams::mapped_file(*mfp);
  return mf->data();
}

I later close the file

void Close()
{
  <<fragment>>
  mf->close();
  delete mfp;
  delete mf;
}
And then want to reopen it

{
  char* fileName = filePath.c_str();
  int test = _open(fileName,_O_BINARY|_O_RDWR);
}
but test is returned -1 -- note that I am able to open the file _O_RDONLY.
 If I close the application and restart it, then I can read the file
_O_RDWR (i.e. test is returned with a valid handle)

Is this a bug or am I doing something wrong?

Thanks Mark



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