bsnes-libretro/bsnes/gb/Windows/utf8_compat.c
Tim Allen ec18efcb04 Add 'bsnes/gb/' from commit '919a88ec23f8011dd0389a4abceb62b3d0c83e00'
git-subtree-dir: bsnes/gb
git-subtree-mainline: 844e23d0f4
git-subtree-split: 919a88ec23
2020-10-12 16:43:40 +11:00

25 lines
693 B
C
Executable File

#include <windows.h>
#include <stdio.h>
#include <winnls.h>
#include <io.h>
FILE *fopen(const char *filename, const char *mode)
{
wchar_t w_filename[MAX_PATH] = {0,};
MultiByteToWideChar(CP_UTF8, 0, filename, -1, w_filename, sizeof(w_filename) / sizeof(w_filename[0]));
wchar_t w_mode[8] = {0,};
MultiByteToWideChar(CP_UTF8, 0, mode, -1, w_mode, sizeof(w_mode) / sizeof(w_mode[0]));
return _wfopen(w_filename, w_mode);
}
int access(const char *filename, int mode)
{
wchar_t w_filename[MAX_PATH] = {0,};
MultiByteToWideChar(CP_UTF8, 0, filename, -1, w_filename, sizeof(w_filename) / sizeof(w_filename[0]));
return _waccess(w_filename, mode);
}