Boost logo

Boost Users :

Subject: [Boost-users] [interprocess] file_lock permission denied
From: Trigve Siver (trigves_at_[hidden])
Date: 2009-11-27 03:08:22


Hi,
I'm trying to use file_lock from interprocess but without success. Here is code I'm using:

m_Stream.exceptions(std::ios::badbit);
m_Stream.open(m_FileName.c_str());
boost::interprocess::file_lock lock(m_FileName.c_str());
...
{
    // Lock file
    boost::interprocess::scoped_lock<boost::interprocess::file_lock> scoped_file_lock(lock);
    // Write to stream
    m_Stream << "Some text";
    m_Stream.flush();
}

where m_Stream is std::ofstream. When "m_Stream.flush()" is executed,
I've got a "badbit" exception with "errno" 0x001b0800 and message (with strerror()) "Permission denied".
I've tried also with win32 CreateFile()/WriteFile() but without success.

I'm using boost 1.40, Visual Studio 2005 SP1, Vista 32 bit SP2

Thanks
Trigve

      


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