Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix visual studio console output #20357

Merged
merged 14 commits into from
Nov 23, 2019
5 changes: 4 additions & 1 deletion cocos/base/CCConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,10 @@ void log(const char * format, ...)
} while (true);
#if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32
buf[nret] = '\n';
#endif
buf[++nret] = '\0';
#else
buf[nret] = '\0';
#endif

#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
__android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf);
Expand All @@ -190,6 +192,7 @@ void log(const char * format, ...)

MultiByteToWideChar(CP_UTF8, 0, tempBuf, -1, wszBuf, sizeof(wszBuf));
OutputDebugStringW(wszBuf);
OutputDebugStringW(L"\n");
WideCharToMultiByte(CP_ACP, 0, wszBuf, -1, tempBuf, sizeof(tempBuf), nullptr, FALSE);
#if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32
printf("%s", tempBuf);
Expand Down