Stop screaming, man. 0) You don't know what 'ASCII' really means (Hint: 'Extended ASCII' is not ASCII.). C and C++ can handle multibyte file names well, no matter whether they are ASCII or not. The way how the runtime handles file names is simply implementation-defined (see WG14 N1570 (Programming languages — C) 7.21.3 Files 8). 1) A `const wchar_t *` does not make things *more* portable. A number of POSIX compliant systems use UTF-32 for wchar_t, which Windows still does not agree with. 2) Some file systems (e.g. FAT without long file name support) don't have wide character support at all.
And here is the solution to your problem: 0) Try to be portable: Use WideCharToMultiByte() or wcstombs() to convert wide character file names to multibyte file names. This could be inefficient since Windows will convert your multibyte file names back to UTF-16 when passing them to the kernal. However this makes less damage to your code. 1) Try to be unique: Create your own file classes that handle I/O using CreateFileW(), ReadFile() and WriteFile() etc and get rid of std::(i|o)?fstream. You will lose 99% portability and have to rewrite a huge amount of code. ------------------ Best regards, lh_mouse 2015-06-30 ------------------------------------------------------------- 发件人:<[email protected]> 发送日期:2015-06-30 01:16 收件人:mingw-w64-public 抄送: 主题:Re: [Mingw-w64-public] no function forstd::ifstream<wchar_t>::open(const wchar_t*)? The standard C++ has major, and I mean MAJOR draw-back!! It cannot handle any other stream format that ASCII. 1988 standards in 2015? I cannot believe it!! I am sure that there are 3rd or 4th party libraries that can handle this issue, but than again, that is that... a 3rd || 4th party library. I am sure that the Win64 API has a way to handle this, if not, those guys at boost seem to be very smart and provably have solved the problem in a way that is portable. ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
