fopen with unicode filename

visual-c++, winapi, windows

Solution

Best way would be to rewrite the lib... Just my 2 Cents.

But if it is just about to open an existing file you can use GetShortPathName You find an existing discussion about this way here.

Problem

I have to use a library that accepts file names as strings (`const char*`). Internally files are opened with `fopen`. Is there a way to make this library to accept unicode file name? Can I use WideCharToMultiByte to convert unicode names into utf before passing them to the library? One possible (undesirable) solution is to change library interface (`char* -> wchar_t*`) and replace `fopen` with windows specific `_wopen`. Another solution is to use create symbolic links to files and pass those to the library, but it is limited to NTFS volumes only.

Original source

Related problems