fix windows consolepauser GetErrorMessage (#419)

This commit is contained in:
Cyano Hao 2024-05-11 08:00:10 +08:00 committed by GitHub
parent b69f234840
commit 97cd0cb3fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 7 deletions

View File

@ -77,13 +77,8 @@ string GetErrorMessage() {
NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),&result[0],result.size(),NULL);
// Clear newlines at end of string
for(int i = result.length()-1;i >= 0;i--) {
if(isspace(result[i])) {
result[i] = 0;
} else {
break;
}
}
while (!result.empty() && (result.back() == 0 || isspace(result.back())))
result.pop_back();
return result;
}