Skip to content

Commit

Permalink
Fix visual studio console output (#20357)
Browse files Browse the repository at this point in the history
  • Loading branch information
rh101 authored and minggo committed Nov 23, 2019
1 parent 796e09f commit 5a9ec25
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit 5a9ec25

Please sign in to comment.