Mercurial > might-and-magic-trilogy
view Log.cpp @ 110:430786d916d6
6.11.12 SaveLoad
author | Ritor1 |
---|---|
date | Tue, 06 Nov 2012 17:30:24 +0600 |
parents | 8b8875f5b359 |
children |
line wrap: on
line source
#include "Log.h" #include <stdio.h> #include <windows.h> HANDLE hStdOut = nullptr; void Log::Initialize() { if (AllocConsole()) hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); } void Log::Warning(const wchar_t *pFormat, ...) { if (!hStdOut) return; va_list args; wchar_t pMsg[8192]; va_start(args, pFormat); vswprintf_s(pMsg, 8192, pFormat, args); va_end(args); DWORD w; WriteConsole(hStdOut, pMsg, lstrlenW(pMsg), &w, nullptr); WriteConsole(hStdOut, L"\r\n", 2, &w, nullptr); }