Sign in to follow this  
demonkoryu

Unicode paths and iostream

Recommended Posts

Hi, I'm desperatly looking for something that allows me to use Unicode path names with iostreams. Strangely enough, even boost::filesystem does not support them, and neither does WinSTL. An example of what I'd like to do follows:
std::wstring path( L"./file.ext" );
std::wifstream file( path.c_str() );
The closest I can get is with the help of the ICU, however even this only extends C-style stdio to handle unicode paths. Well, I am developing a Win32 program, so I could just use the CreateFileW function, but that doesn't fit with the rest of my program, which tries to rely only on SC++L iostreams, boost and winSTL. How do you handle Unicode in your path names? [Edited by - Konfusius on November 25, 2005 8:37:58 AM]

Share this post


Link to post
Share on other sites
Unfortuntaly if you want to stick with the standard library streams you need to use narrow characters as file names. You can use wcstombs() to narrow the wide character streams, or if you're feeling adventurous, the narrow() member function of the ctype facet of a locale.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this