This commit is contained in:
2024-04-26 15:37:28 +08:00
parent b6cffd8a97
commit c9152bffa8
13 changed files with 171 additions and 71 deletions

View File

@ -1,17 +1,19 @@
#include "IOHelper.hpp"
#if YYCC_OS == YYCC_OS_WINDOWS
#include "EncodingHelper.hpp"
#include <cstdio>
#include <iostream>
namespace YYCC::IOHelper {
void GetCmdLine(std::string& u8cmd) {
void Gets(std::string& u8cmd) {
std::wstring wcmd;
std::getline(std::wcin, wcmd);
YYCC::EncodingHelper::WcharToChar(wcmd, u8cmd, CP_UTF8);
}
FILE* UTF8FOpen(const char* u8_filepath, const char* u8_mode) {
FILE* FOpen(const char* u8_filepath, const char* u8_mode) {
std::wstring wmode, wpath;
bool suc = YYCC::EncodingHelper::CharToWchar(u8_mode, wmode, CP_UTF8);
suc = suc && YYCC::EncodingHelper::CharToWchar(u8_filepath, wpath, CP_UTF8);
@ -25,3 +27,5 @@ namespace YYCC::IOHelper {
}
}
#endif