Boost logo

Boost :

From: Arjen Wagenaar (arjenw_at_[hidden])
Date: 2006-03-31 04:44:23


Hi Beman,

> >
> > == openmode differences for path/wpath
> >
> > I ran into a few calls where fs::ofstreams where opened in binary mode,
> > but
> > the std::ios_base::out flag wasn't specified. This worked fine for
> paths,
> > but for wpaths this was giving asserts as the narrow_path() function
> > specifically checks for this flag.
>
> Good catch. CVS has been changed to OR in the correct flag. The problem
> also
> affected ifstreams and fstreams.
>

I've just checked with the latest CVS and the test_out_mode_wide() case (see
below) still fails (on windows). The file is not created.

In fstream.hpp(369) a call is made to detail::path_proxy with a mode
parameter without the std::ios_base_out flag. This flag is checked in
fstream.hpp(57).

--- snip

  template<typename Path>
  void test_no_out_mode(Path const& p)
  {
    fs::remove(p);
    fs::ofstream str(p, std::ios_base::binary);
    BOOST_CHECK(!!str);
    BOOST_CHECK(fs::exists(p));
  }

  void test_out_mode_narrow()
  {
    test_no_out_mode(fs::path("new_file_narrow"));
  }

  void test_out_mode_wide()
  {
    test_no_out_mode(fs::wpath(L"new_file_wide"));
  }

filesystem_unit.cpp(33): error in "filesystem_test::test_out_mode_wide":
heck !!str failed
filesystem_unit.cpp(34): error in "filesystem_test::test_out_mode_wide":
heck fs::exists(p) failed

--- snip

Regards,

Arjen


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk