Topic: open an fstream to a file with wchar_t string name?


Author: Chuck_McDevitt@c-o-m-c-a-s-t.net ("Chuck McDevitt")
Date: Fri, 3 Oct 2003 01:58:04 +0000 (UTC)
Raw View
I have a program where I have a filename in a wchar_t string (it's unicode).

I want to open an ifstream to the file, but there is no wopen(), only
open(), which gets a char* string.

I'm perplexed.  Why doesn't ifstream have a wopen() method?

And, given that it doesn't, how to I know what conversion should be applied
to my unicode string to make it into a char string that will point to the
same file?
Obviously, I can convert to utf-8, but there is nothing that says open()
should treat the filename as utf-8.
It could treat it as EUC, iso-latin-1, etc.

Is there a portable way to do the "right" thing?

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]