From 5af32db45fe90912f389cccec5f9ef5baad20d7e Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Thu, 6 Jun 2024 23:32:30 +0800 Subject: [PATCH] some fix --- src2/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src2/main.cpp b/src2/main.cpp index e38ce954..70c6ed4c 100644 --- a/src2/main.cpp +++ b/src2/main.cpp @@ -25,7 +25,8 @@ std::string pkpy_platform_getline(bool* eof) { } std::wstring wideInput = wss.str(); int length = WideCharToMultiByte(CP_UTF8, 0, wideInput.c_str(), (int)wideInput.length(), NULL, 0, NULL, NULL); - std::string output(length); + std::string output; + output.resize(length); WideCharToMultiByte(CP_UTF8, 0, wideInput.c_str(), (int)wideInput.length(), &output[0], length, NULL, NULL); if(!output.empty() && output.back() == '\r') output.pop_back(); return output;