_wfopen equivalent under Mac OS X

后端 未结 5 1297
甜味超标
甜味超标 2021-02-07 06:30

I\'m looking to the equivalent of Windows _wfopen() under Mac OS X. Any idea?

I need this in order to port a Windows library that uses wchar* for its File i

5条回答
  •  醉梦人生
    2021-02-07 06:57

    I have read file name from configuration UTF8 file through wifstream (it uses wchar_t buffer).

    Mac implementation is different from Linux and Windows. wifstream reads each byte from file to separate wchar_t cell in the buffer. So we have 3 empty bytes, although open requires char string. Thus programmer can use wcstombs function to convert wide character string to multi-byte string.

    The API supports UTF8. For better understanding use memory watcher and hex editor for your file.

提交回复
热议问题