修复 popen

This commit is contained in:
baidwwy 2021-04-23 16:16:05 +08:00
parent e9ffb03491
commit 73417ca8ca
2 changed files with 12 additions and 0 deletions

View File

@ -20,6 +20,16 @@ FILE* utf8_fopen(const char* _FileName, const char* _Mode) {
return _wfopen(FileName, Mode);
}
FILE* utf8_popen(const char* _FileName, const char* _Mode) {
WCHAR FileName[MAX_PATH];
memset(FileName, 0, sizeof(FileName));
UTF8ToUnicode(_FileName, FileName);
WCHAR Mode[MAX_PATH];
memset(Mode, 0, sizeof(Mode));
UTF8ToUnicode(_Mode, Mode);
return _wpopen(FileName, Mode);
}
FILE* utf8_freopen(const char* _FileName, const char* _Mode, FILE* _OldStream) {
WCHAR FileName[MAX_PATH];
memset(FileName, 0, sizeof(FileName));

View File

@ -6,6 +6,7 @@
#include <windows.h>
FILE* utf8_fopen(char const* _FileName, char const* _Mode);
FILE* utf8_popen(char const* _FileName, char const* _Mode);
FILE* utf8_freopen(const char* _FileName, const char* _Mode, FILE* _OldStream);
int utf8_system(const char* _Command);
const char* utf8_getenv(char const* _VarName);
@ -13,6 +14,7 @@ int utf8_remove(const char* _FileName);
int utf8_rename(char const* _OldFileName, char const* _NewFileName);
#define fopen utf8_fopen
#define _popen utf8_popen
#define freopen utf8_freopen
#define system utf8_system//execute
#define getenv utf8_getenv