简体   繁体   中英

Opening Unicode filenames in windows from DOS 8.3 filenames

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 alternative. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM