Blog Categories
Blog Tags
Social Media
Powered by Squarespace
Monday
Jun062011

New Website

After recently completing my degree in Computer Games Programming at the University of Teesside, I have decided to revamp my website and update it to show all my latest portfolio work. My website was previously hosted on godaddy servers, but after suffering 2 years worth of substandard service i have now decided to move to a platform called squarespace.com

I am still in the process of updating all portfolio content, but my website has now fully moved home and will remain here for the foreseeable future, I hope you all enjoy the new site.

Monday
Jun212010

How to Open Console Window in a Win32 Application

When you create a basic main()-based application, you get the console window implicitly; but a typical WinMain()-based application does not open a console window – you have to allocate the console and to connect the I/O streams yourself.

Yet, this is not a thing you find described in manuals. Fortunately, it’s simple to do, and the code presented here can be used as-is in all your projects.

 

#include <stdio.h>
#include <io.h>
#include <fcntl.h>

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
AllocConsole();

HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
int hCrt = _open_osfhandle((long) handle_out, _O_TEXT);
FILE* hf_out = _fdopen(hCrt, "w");
setvbuf(hf_out, NULL, _IONBF, 1);
*stdout = *hf_out;

HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
hCrt = _open_osfhandle((long) handle_in, _O_TEXT);
FILE* hf_in = _fdopen(hCrt, "r");
setvbuf(hf_in, NULL, _IONBF, 128);
*stdin = *hf_in;

// use the console just like a normal one - printf(), getchar(), ...
}
Friday
Jan012010

2010 NEW YEAR'S RESOLUTIONS

  1. Take more pictures "Use my new camera ;-)"
  2. Learn more about c++ and other languages
  3. Drink more water
  4. See more live music
  5. Build an iPhone application "app"
  6. Expand my cinema horizons includes going to the cinema more
  7. Complete some of my games ive bought but not yet played
  8. Advance internet presence
  9. Complete GS1 coding project
  10. Have a great year... Fingers crossed ;-)