Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-02-23 15:31:49


At 02:57 PM 2/23/2002, Carl Daniel wrote:

>> Follow-on question: Using the C++ standard library on Win32, how do
you
>> open a file that requires std::wstring to represent the filename? Or
is
>> there no way to do that without resorting to the Win32 API?
>
>AFIAK, there's no neat way to do it. Converting the wstring back to
>ANSI/multi-byte is A) a pain and B) wrong in the
>long run, since the Unicode name might have characters not representable
in
>an MBCS. IMO the standard library stream
>classes should offer wchar_t constructors independent of whether the
>stream's CharT is char or wchar_t.

Hum... The fstream constructors (and open) now take only "const char* s".

LWG members (Matt Austern?) have said "const string& s" overloads should
also be provided, IIRC.

If I understand you correctly, you are saying that this should also be
extended to include "const wstring& s" overloads?

What should happen if the operating system doesn't support wstring file
names? Is the implementation obliged to try to convert the wstring to
something it understands? Does the standard need to specify this, or is it
purely a quality-of-implementation (QOI) issue?

--Beman


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