Skip to content

Instantly share code, notes, and snippets.

View kingseva's full-sized avatar

Dmitriy kingseva

View GitHub Profile
@kingseva
kingseva / allocterminal.cpp
Created January 27, 2018 15:11
Example redirecting cout/stdout to allocated terminal in GUI programs.
#include "rang.hpp"
#include <windows.h>
#include <cstdlib>
void BindStdHandlesToConsole()
{
//TODO: Add Error checking.
// Redirect the CRT standard input, output, and error handles to the console
make[1]: Entering directory `/home/loki/builds/mxe/mxe'
uname -a
Linux saturn1 3.13.0-63-generic #103-Ubuntu SMP Fri Aug 14 21:42:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1
27facf1c6fcb7973781568dde9b0c1072e28f669 - Merge pull request #1659 from tonytheodore/gcc5-fix [5 days ago] [ (HEAD, origin/master, origin/HEAD, master)]
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
make[1]: Entering directory `/home/loki/builds/mxe/mxe'
make[1]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
uname -a
Linux saturn1 3.13.0-63-generic #103-Ubuntu SMP Fri Aug 14 21:42:59 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1
27facf1c6fcb7973781568dde9b0c1072e28f669 - Merge pull request #1659 from tonytheodore/gcc5-fix [2 days ago] [ (HEAD, origin/master, origin/HEAD, master)]
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04