Skip to content

Commit 9d29b53

Browse files
committed
better stdout redirection
1 parent 17636b9 commit 9d29b53

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,4 +359,6 @@ MigrationBackup/
359359
.ionide/
360360

361361
# Fody - auto-generated XML schema
362-
FodyWeavers.xsd
362+
FodyWeavers.xsd
363+
364+
ffmpeg/

dllmain.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "PlayLayer.h"
55
#include "PlayerObject.h"
66
#include "GameManager.h"
7+
#include <fstream>
78

89
void readInput(HMODULE hModule) {
910
for (std::string line; std::getline(std::cin, line);) {
@@ -47,8 +48,10 @@ DWORD WINAPI my_thread(void* hModule) {
4748

4849
AllocConsole();
4950
SetConsoleTitleA("Console");
50-
freopen_s(reinterpret_cast<FILE**>(stdout), "CONOUT$", "w", stdout);
51+
// freopen_s(reinterpret_cast<FILE**>(stdout), "CONOUT$", "w", stdout);
5152
freopen_s(reinterpret_cast<FILE**>(stdin), "CONIN$", "r", stdin);
53+
static std::ofstream conout("CONOUT$", std::ios::out);
54+
std::cout.rdbuf(conout.rdbuf());
5255

5356
auto base = reinterpret_cast<uintptr_t>(GetModuleHandle(0));
5457

0 commit comments

Comments
 (0)