mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-23 12:18:37 -05:00
Console window and output for windows
This commit is contained in:
parent
951a1ee9c6
commit
96c05cd532
@ -1,7 +1,6 @@
|
||||
#define OPENGL
|
||||
|
||||
#include "CubicSDRDefs.h"
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
@ -21,6 +20,19 @@
|
||||
|
||||
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() {
|
||||
#ifdef _OSX_APP_
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||
@ -38,6 +50,17 @@ bool CubicSDR::OnInit() {
|
||||
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");
|
||||
|
||||
config.load();
|
||||
|
Loading…
Reference in New Issue
Block a user