diff options
Diffstat (limited to 'qstd')
-rw-r--r-- | qstd/plat.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/qstd/plat.c b/qstd/plat.c index b34e8cb..d1f15e7 100644 --- a/qstd/plat.c +++ b/qstd/plat.c @@ -128,8 +128,9 @@ uint64_t get_time(void) { #include <stdio.h> #include <windows.h> -#include <stdio.h> +#include <debugapi.h> #include <io.h> +#include <stdio.h> int imp_assert( int val, @@ -156,7 +157,10 @@ void print(const char* fmt, ...) { va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); - OutputDebugStringA(buf); + if (IsDebuggerPresent()) + OutputDebugStringA(buf); + else + printf("%s\n", buf); } void print_err(const char* fmt, ...) { @@ -165,7 +169,10 @@ void print_err(const char* fmt, ...) { va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); - OutputDebugStringA(buf); + if (IsDebuggerPresent()) + OutputDebugStringA(buf); + else + printf("%s\n", buf); } void print_war(const char* fmt, ...) { @@ -174,7 +181,10 @@ void print_war(const char* fmt, ...) { va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); - OutputDebugStringA(buf); + if (IsDebuggerPresent()) + OutputDebugStringA(buf); + else + printf("%s\n", buf); } void pbreak(int code) { |