From: Anthony West on
Is there a way to test a stream for binariness? Specifically: given an
ofstream, is there some method I can call (or some member I can access)
that tells me if the ofstream was opened in binary mode?

If not, why?

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: alasham.said on
On Apr 19, 1:20 am, Anthony West <w...(a)ices.utexas.edu> wrote:
> Is there a way to test a stream for binariness? Specifically: given an
> ofstream, is there some method I can call (or some member I can access)
> that tells me if the ofstream was opened in binary mode?
>
> If not, why?

{ Do not quote extraneous material, such as the clc++m banner,
which has been removed by the moderator. -mod }

I do not think there is such a method. You could wrap up std::ofstream
inside another class that then keeps the desired information: file-
name, i/o mode, etc. As for why the class is designed this way,
perhaps the reason is mentioned in "The Design and Evolution of C++".

Regards

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]