blueloveTH 1 năm trước cách đây
mục cha
commit
5af32db45f
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      src2/main.cpp

+ 2 - 1
src2/main.cpp

@@ -25,7 +25,8 @@ std::string pkpy_platform_getline(bool* eof) {
     }
     }
     std::wstring wideInput = wss.str();
     std::wstring wideInput = wss.str();
     int length = WideCharToMultiByte(CP_UTF8, 0, wideInput.c_str(), (int)wideInput.length(), NULL, 0, NULL, NULL);
     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);
     WideCharToMultiByte(CP_UTF8, 0, wideInput.c_str(), (int)wideInput.length(), &output[0], length, NULL, NULL);
     if(!output.empty() && output.back() == '\r') output.pop_back();
     if(!output.empty() && output.back() == '\r') output.pop_back();
     return output;
     return output;