Hello List,
 
Could someone please give me a working example of how to use this please. I am obviously doing something wrong as depending on how much I write to the std::ofstream I either end up with a proper file or a file containing a single byte!
 
I would really appreciate your assistance with this as it's driving me to distraction.
 
Here is the approach I am taking.
 
std::ofstream os  ;
os.open(m_FileName.c_str(), std::ios_base::out | std::ios_base::binary | std::ios_base::app) ;
try
{
 if (os.is_open())
 {
  os.setf(std::ios::fixed, std::ios::floatfield) ;
  os.precision(3) ;
  if (fileLock.timed_lock(pt += pt::seconds(5)))
  {
   try
   {
    for (int o = 0; o < 48; o++)
    {
     os << "Write my data here....." ;
     for (int i = 0; i < 51)
     {
      os << i ; // But if I output this simple line and I get a 1 byte file and NO errors or exceptions!
     }
    }
    fileLock.unlock() ;
   }
   catch (std::ofstream::failure e)
   {
    qDebug() << e.what() ;
   }
  }
  else
  {
   qDebug() << "No lock on file!" ;
  }
 }
 else
 {
  qDebug() << "File not opened!" ;
 }
}
catch (ip::interprocess_exception& e)
{
 qDebug() << e.what() ;
}
catch (std::exception& e)
{
 qDebug() << e.what() ;
}
os.close();

--
Bill