Boost logo

Boost Users :

From: Marc Viala Perso (marc.viala_at_[hidden])
Date: 2008-02-02 15:09:23


> -----Message d'origine-----
> bounces_at_[hidden]] De la part de Steven Watanabe
> Envoyé : vendredi 1 février 2008 21:16
> > 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
> > VisuIal C++ 7.1
> > Windows XP
> >
>
> Does it work with std::ofstream using back-slashes and raw C strings?

[Marc Viala]
I've replaced slashes by black-slashes in fs::path (p and wp) to confirm the
same behaviour: I've got an assert at the same code line.

My feeling is that the default opening mode "std::ios_base::out" in
conjunction with fs::ofstream is overwritten; for example, if someone
replace the last "ofile" declaration with that one:

        fs::ofstream ofile(wp, std::ios_base::binary| std::ios_base::out)

every thing work fine!!

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