SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
Windows/utf8_compat.c
1 #include <windows.h>
2 #include <stdio.h>
3 #include <winnls.h>
4 #include <io.h>
5
6 FILE *fopen(const char *filename, const char *mode)
7 {
8 wchar_t w_filename[MAX_PATH] = {0,};
9 MultiByteToWideChar(CP_UTF8, 0, filename, -1, w_filename, sizeof(w_filename) / sizeof(w_filename[0]));
10
11 wchar_t w_mode[8] = {0,};
12 MultiByteToWideChar(CP_UTF8, 0, mode, -1, w_mode, sizeof(w_mode) / sizeof(w_mode[0]));
13
14 return _wfopen(w_filename, w_mode);
15 }
16
17 int access(const char *filename, int mode)
18 {
19 wchar_t w_filename[MAX_PATH] = {0,};
20 MultiByteToWideChar(CP_UTF8, 0, filename, -1, w_filename, sizeof(w_filename) / sizeof(w_filename[0]));
21
22 return _waccess(w_filename, mode);
23 }
24
25 int _creat(const char *filename, int mode)
26 {
27 wchar_t w_filename[MAX_PATH] = {0,};
28 MultiByteToWideChar(CP_UTF8, 0, filename, -1, w_filename, sizeof(w_filename) / sizeof(w_filename[0]));
29 return _wcreat(w_filename, mode & 0700);
30 }
31
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.