Topic: Standard C++ wide character support for fstream filenames


Author: "Simone Petruzzi" <s.petruzzi@auton.it>
Date: Fri, 22 Dec 2000 11:26:03 GMT
Raw View
The recently approved standard C++ include support for wide character
(wchar_t).
My problem is with fstream. I can't use wide character filenames when
opening a file with both fstream constructor and open method: it doesn't
appear to exist any open method accepting a wide character pointer as
filename.
Thus the following code doesn't work:

wchar_t *l_str;
...
std::fstream l_file;
l_file.open(l_str,std::ios::binary|std::ios::in);

How can I open a file with a wide character name using standard C++?
If in the C++ standard wide character names for file streams were
deliberately omitted how can I open correctly a file in order to have it
work also in the eastern countries (for example Japan)?
Is it always possible to translate a wide character string to a MBCS
(Multi - Byte Character String) and use the MBCS as filename in the open
method of fstream?

Thanks,
Dr. Simone Petruzzi





---
[ 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.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]