wide-api

Opening fstream with file with Unicode file name under Windows using non-MSVC compiler

雨燕双飞 提交于 2019-11-28 11:10:00
I need to open a file as std::fstream (or actually any other std::ostream) when file name is "Unicode" file name. Under MSVC I have non-standard extension std::fstream::open(wchar_t const *,...) ? What can I do with other compilers like GCC (most important) and probably Borland compiler. I know that CRTL provides _wfopen but it gives C FILE * interface instead of io-streams, maybe there is a non-standard way to create io-stream from FILE * ? Is there any boost::ifstream with MSVC like extension for Windows? Kornel Kisielewicz Unfortunately, there's no standard way to do that, although C++0x

Opening fstream with file with Unicode file name under Windows using non-MSVC compiler

安稳与你 提交于 2019-11-27 19:21:09
问题 I need to open a file as std::fstream (or actually any other std::ostream) when file name is "Unicode" file name. Under MSVC I have non-standard extension std::fstream::open(wchar_t const *,...) ? What can I do with other compilers like GCC (most important) and probably Borland compiler. I know that CRTL provides _wfopen but it gives C FILE * interface instead of io-streams, maybe there is a non-standard way to create io-stream from FILE * ? Is there any boost::ifstream with MSVC like

utfcpp and Win32 wide API

被刻印的时光 ゝ 提交于 2019-11-26 21:56:28
问题 Is it good/safe/possible to use the tiny utfcpp library for converting everything I get back from the wide Windows API (FindFirstFileW and such) to a valid UTF8 representation using utf16to8? I would like to use UTF8 internally, but am having trouble getting the correct output (via wcout after another conversion or plain cout). Normal ASCII characters work of course, but ñä gets messed up. Or is there an easier alternative? Thanks! UPDATE: Thanks to Hans (below), I now have an easy UTF8<-