开发者

Opening Unicode filenames in windows from DOS 8.3 filenames

开发者 https://www.devze.com 2023-03-15 02:42 出处:网络
Can I generate a 8.3 filename for a unicode filename and use that ASCII string of char\'s to open an fstream in Windows?

Can I generate a 8.3 filename for a unicode filename and use that ASCII string of char's to open an fstream in Windows?

I know that MSVC++ provides a wchar_t* overload for fstream, but GCC's libstdc++ does not provide this :(, so I need an alterna开发者_开发百科tive. I don't want to create my own streambuf class just for this, as it seems overkill.


You can probably leverage the Windows API function GetShortPathName to give you the short name. You cannot "compute" the name algorithmically as there is no one-to-one correspondence between an arbitrary long name and a short name, and I don't think you can avoid using the Windows API for the translation.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号