-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpch.cpp
More file actions
65 lines (46 loc) · 1.13 KB
/
Copy pathpch.cpp
File metadata and controls
65 lines (46 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// pch.cpp: source file corresponding to the pre-compiled header
#include "pch.h"
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
#if _DEBUG
int console_print(const char* format, ...)
{
va_list va_args;
va_start(va_args, format);
int result = vprintf_s(format, va_args);
va_end(va_args);
return result;
}
int console_print(const wchar_t* format, ...)
{
va_list va_args;
va_start(va_args, format);
int result = vwprintf_s(format, va_args);
va_end(va_args);
return result;
}
#else
int console_print(const char* format, ...)
{
char* buffer = new char[4096]{};
va_list va_args;
va_start(va_args, format);
int result = vsprintf_s(buffer, 4096, format, va_args);
OutputDebugStringA(buffer);
va_end(va_args);
delete[] buffer;
buffer = nullptr;
return result;
}
int console_print(const wchar_t* format, ...)
{
wchar_t* buffer = new wchar_t[4096]{};
va_list va_args;
va_start(va_args, format);
int result = vswprintf_s(buffer, 4096, format, va_args);
OutputDebugStringW(buffer);
va_end(va_args);
delete[] buffer;
buffer = nullptr;
return result;
}
#endif // _DEBUG