rubenvb
rubenvb

Reputation: 76519

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.

Upvotes: 1

Views: 1122

Answers (1)

Kerrek SB
Kerrek SB

Reputation: 476930

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.

Upvotes: 3

Related Questions