mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-16 17:09:31 +01:00
23 lines
469 B
C++
23 lines
469 B
C++
#include "utils.h"
|
|
|
|
#include <flutter_windows.h>
|
|
#include <io.h>
|
|
#include <stdio.h>
|
|
#include <windows.h>
|
|
|
|
#include <iostream>
|
|
|
|
void CreateAndAttachConsole() {
|
|
if (::AllocConsole()) {
|
|
FILE *unused;
|
|
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
|
|
_dup2(_fileno(stdout), 1);
|
|
}
|
|
if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
|
|
_dup2(_fileno(stdout), 2);
|
|
}
|
|
std::ios::sync_with_stdio();
|
|
FlutterDesktopResyncOutputStreams();
|
|
}
|
|
}
|