mirror of https://github.com/flutter/samples.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
469 B
23 lines
469 B
#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();
|
|
}
|
|
}
|