Commit 2579073a authored by Martin Schultz's avatar Martin Schultz

changed the CONNECT_CONSOLE define to a void function

parent 7ee09b81
......@@ -111,19 +111,21 @@
#ifdef WIN32
#define CONNECT_CONSOLE \
FILE* check = freopen("CONIN$", "r", stdin); \
if (check) { \
std::cerr << "Error reopening stdin" << std::endl; \
} \
check = freopen("CONOUT$", "w", stdout); \
if (check) { \
std::cerr << "Error reopening stdout" << std::endl; \
} \
check = freopen("CONOUT$", "w", stderr); \
if (check) { \
std::cerr << "Error reopening stderr" << std::endl; \
void connect_console()
{
FILE* check = freopen("CONIN$", "r", stdin);
if (check) {
std::cerr << "Error reopening stdin" << std::endl;
}
check = freopen("CONOUT$", "w", stdout);
if (check) {
std::cerr << "Error reopening stdout" << std::endl;
}
check = freopen("CONOUT$", "w", stderr);
if (check) {
std::cerr << "Error reopening stderr" << std::endl;
}
}
void attachConsole()
{
......@@ -131,7 +133,7 @@
if (AttachConsole(-1))
{
//if the console was attached change stdinput and output
CONNECT_CONSOLE
connect_console();
}
else
{
......@@ -139,14 +141,14 @@
#ifndef NDEBUG
//always open a console in debug mode
AllocConsole();
CONNECT_CONSOLE
connect_console();
return;
#endif
if (OpenFlipper::Options::logToConsole())
{
AllocConsole();
CONNECT_CONSOLE
connect_console();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment