views:

96

answers:

3

i am using a function that receives ostream but i have wostream is there a way to convert one to the other?

in particular i want to use boost::write_graphviz which takes ostream but i currently in << operator for wostream.

A: 

I don't believe you can convert. You will have to get an ostream.

DeadMG
Of course you can convert them, using an adaptor.
Konrad Rudolph
A: 

If I were you I'd rather change my approach, rather than trying to convert wostream to ostream. I am sure that what you want to get can easily be achieved without wide char streams.

Of course, it depends on what is the actual purpose of your application, but in 9 of 10 cases simple implemention of your own converting routine or usage of third-party libraries (e.g. iconv) would obviously be enough.

Update: (as a proof of what I'm saying) Google code has only one search result for wofstream and two - for wifstream. Doesn't that fact speak for itself?

Kotti
A: 
Noah Roberts