
AMDG Marc Viala Perso wrote:
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
Does it work with std::ofstream using back-slashes and raw C strings? In Christ, Steven Watanabe