Yes, here is a nice class I added on to:
#pragma once
#include <io.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h> /* for _O_TEXT and _O_BINARY */
#include <errno.h> /* for EINVAL */
#include <sys\stat.h> /* for _S_IWRITE */
#include <share.h> /* for _SH_DENYNO */
#include <iostream>
#ifndef _USE_OLD_IOSTREAMS
using namespace std;
#endif
namespace Engine
{
class CConsole
{
private:
void RedirectIO(WORD MaxLines);
public:
CConsole();
~CConsole();
void Open(const char* szWindowTitle, WORD MaxLines);
void Write(const char *szOutput);
void Clear();
void SetTextColor(const char* szColor);
void Close();
};
CConsole::CConsole()
{
}
CConsole::~CConsole()
{
}
void CConsole::RedirectIO(WORD MaxLines)
{
int hConHandle;
long lStdHandle;
CONSOLE_SCREEN_BUFFER_INFO coninfo;
FILE *fp;
AllocConsole();
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),
&coninfo);
coninfo.dwSize.Y = MaxLines;
SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE),
coninfo.dwSize);
lStdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
fp = _fdopen( hConHandle, "w" );
*stdout = *fp;
setvbuf( stdout, NULL, _IONBF, 0 );
lStdHandle = (long)GetStdHandle(STD_INPUT_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
fp = _fdopen( hConHandle, "r" );
*stdin = *fp;
setvbuf( stdin, NULL, _IONBF, 0 );
lStdHandle = (long)GetStdHandle(STD_ERROR_HANDLE);
hConHandle = _open_osfhandle(lStdHandle, _O_TEXT);
fp = _fdopen( hConHandle, "w" );
*stderr = *fp;
setvbuf( stderr, NULL, _IONBF, 0 );
ios::sync_with_stdio();
}
void CConsole::Open(const char* szWindowTitle, WORD MaxLines)
{
SetConsoleTitle(szWindowTitle);
RedirectIO(MaxLines);
}
void CConsole::Write(const char *szOutput)
{
cout << szOutput << endl;
}
void CConsole::Clear()
{
HANDLE hStdOut;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD count;
DWORD cellCount;
COORD homeCoords = { 0, 0 };
hStdOut = GetStdHandle( STD_OUTPUT_HANDLE );
if (hStdOut == INVALID_HANDLE_VALUE) return;
if (!GetConsoleScreenBufferInfo( hStdOut, &csbi )) return;
cellCount = csbi.dwSize.X *csbi.dwSize.Y;
if (!FillConsoleOutputCharacter(
hStdOut,
(TCHAR) ' ',
cellCount,
homeCoords,
&count
)) return;
if (!FillConsoleOutputAttribute(
hStdOut,
csbi.wAttributes,
cellCount,
homeCoords,
&count
)) return;
SetConsoleCursorPosition( hStdOut, homeCoords );
}
void CConsole::SetTextColor(const char* szColor)
{
HANDLE hHandle = GetStdHandle(STD_OUTPUT_HANDLE);
if (szColor == "white")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE |
FOREGROUND_INTENSITY);
}
if (szColor == "grey")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE );
}
if (szColor == "red")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_RED);
}
if (szColor == "lightred")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_RED | FOREGROUND_INTENSITY);
}
if (szColor == "green")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_GREEN);
}
if (szColor == "lightgreen")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_GREEN | FOREGROUND_INTENSITY);
}
if (szColor == "blue")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_BLUE);
}
if (szColor == "lightblue")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_BLUE | FOREGROUND_INTENSITY);
}
if (szColor == "yellow")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_RED | FOREGROUND_GREEN);
}
if (szColor == "lightyellow")
{
SetConsoleTextAttribute(hHandle,
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
}
}
void CConsole::Close()
{
HWND hConsole = GetConsoleWindow();
if(hConsole){
CloseWindow(hConsole);}
FreeConsole();
}
}
It allows you to open/close the console, clear the screen, and color the text.
You may have to set your code generation settings to "Multi-Threaded /MT"
If you want to display things on the screen use "dbText"