Jump to content
  • Advertisement
Sign in to follow this  
demonkoryu

Unicode paths and iostream

This topic is 4593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
... or you can join the rest of the world and use the methods that SiCrane detailed. They work, just try it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!