mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-02-03 09:44:26 -05:00
Console window and output for windows
This commit is contained in:
parent
951a1ee9c6
commit
96c05cd532
@ -1,7 +1,6 @@
|
|||||||
#define OPENGL
|
#define OPENGL
|
||||||
|
|
||||||
#include "CubicSDRDefs.h"
|
#include "CubicSDRDefs.h"
|
||||||
|
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
@ -21,6 +20,19 @@
|
|||||||
|
|
||||||
IMPLEMENT_APP(CubicSDR)
|
IMPLEMENT_APP(CubicSDR)
|
||||||
|
|
||||||
|
// console output buffer for windows
|
||||||
|
#ifdef _WIN64_
|
||||||
|
class outbuf : public std::streambuf {
|
||||||
|
public:
|
||||||
|
outbuf() {
|
||||||
|
setp(0, 0);
|
||||||
|
}
|
||||||
|
virtual int_type overflow(int_type c = traits_type::eof()) {
|
||||||
|
return fputc(c, stdout) == EOF ? traits_type::eof() : c;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
bool CubicSDR::OnInit() {
|
bool CubicSDR::OnInit() {
|
||||||
#ifdef _OSX_APP_
|
#ifdef _OSX_APP_
|
||||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||||
@ -38,6 +50,17 @@ bool CubicSDR::OnInit() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console output for windows
|
||||||
|
#ifdef _WIN64_
|
||||||
|
if (AllocConsole()) {
|
||||||
|
freopen("CONOUT$", "w", stdout);
|
||||||
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
|
||||||
|
}
|
||||||
|
outbuf ob;
|
||||||
|
std::streambuf *sb = std::cout.rdbuf(&ob);
|
||||||
|
std::cout.rdbuf(sb);
|
||||||
|
#endif
|
||||||
|
|
||||||
wxApp::SetAppName("CubicSDR");
|
wxApp::SetAppName("CubicSDR");
|
||||||
|
|
||||||
config.load();
|
config.load();
|
||||||
|
Loading…
Reference in New Issue
Block a user