#include "Main.h" Console::Console(){ __fStdOut = NULL; __hStdOut = NULL; } Console::~Console(){ } void Console::startConsoleWin(int width, int height, char* fname){ AllocConsole(); SetConsoleTitle("Debug Window"); __hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); COORD co = {width,height}; SetConsoleScreenBufferSize(__hStdOut, co); if(fname) __fStdOut = fopen(fname, "w"); } int Console::wprintf(char *fmt, ...){ DWORD cCharsWritten; WriteConsole(__hStdOut, "h", (DWORD)strlen("h"), &cCharsWritten, NULL); char s[300]; va_list argptr; int cnt; va_start(argptr, fmt); cnt = vsprintf(s, fmt, argptr); va_end(argptr); if(__hStdOut) WriteConsole(__hStdOut, s, (DWORD)strlen(s), &cCharsWritten, NULL); return(cnt); }