Boost logo

Boost Users :

From: Marc Viala Perso (marc.viala_at_[hidden])
Date: 2008-02-01 11:46:26


Hi,

I not pretty sure but it seems that there is a bug (?) somewhere in
boost::filesystem::ofstream implementation in the Boost 1.34.1 release; to
exhibit this behaviour, the snippet code hereafter trigger an assert in the
last block:

int main(int /*argc*/, char* /*argv[]*/)
{
  const fs::path p("c:/temp/test.txt") ;
  const fs::wpath wp(L"c:/temp/test.txt") ;
  {
    fs::remove(p) ;
    fs::ofstream ofile(p) ;
    assert(!ofile.fail()) ;
  }
  {
    fs::remove(p) ;
    fs::ofstream ofile(wp) ;
    assert(!ofile.fail()) ;
  }

  {
    fs::remove(p) ;
    fs::ofstream ofile(p, std::ios_base::binary) ;
    assert(!ofile.fail()) ;
  }
  {
    fs::remove(p) ;
    fs::ofstream ofile(wp, std::ios_base::binary) ;
    assert(!ofile.fail()) ; // <-- Assert triggered here
  }
}

Running conditions:
Boost 1.34.1
Visual C++ 7.1
Windows XP

I'm waiting for your feedback.

Best regards,

Marc VIALA


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