|
Boost Users : |
Subject: Re: [Boost-users] [filesystem] wpath and fopen() on windows
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2010-02-10 17:19:50
On Wed, Feb 10, 2010 at 7:21 AM, Paul <elegant_dice_at_[hidden]> wrote:
> Hi,
> What is the best way for me to use boost::filesystem::wpath with a 3rd party
> C library that expects a const char* filename, on Windows?
> On linux, its simple: my_file.to_external_string() Â but on windows that
> gives me a wide-character string.
> So far the only thing I can think of is to roll my own wstring --> UTF8
> conversion function, but I'm not even sure that is correct (will fopen()
> work with UTF-8 encoded filenames on windows?).
> thanks,
That is correct. On Windows XP and higher *all* file function use
wide-character strings. Their are ascii versions of the same
functions, but you can see the implementation and they just convert
the string to a wide then call the normal function, hence having it
wide in the first place saves you time. It seems pretty stupid to
convert from wide to ascii just to have the system waste even more
time converting from ascii back to wide. I do not think file
functions will work with all UTF-8 though as UTF-8 support in the
Windows kernel is... lacking...
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net