Skip to content

Commit

Permalink
better stdout redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Feb 15, 2021
1 parent 17636b9 commit 9d29b53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -359,4 +359,6 @@ MigrationBackup/
.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd
FodyWeavers.xsd

ffmpeg/
5 changes: 4 additions & 1 deletion dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "PlayLayer.h"
#include "PlayerObject.h"
#include "GameManager.h"
#include <fstream>

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

AllocConsole();
SetConsoleTitleA("Console");
freopen_s(reinterpret_cast<FILE**>(stdout), "CONOUT$", "w", stdout);
// freopen_s(reinterpret_cast<FILE**>(stdout), "CONOUT$", "w", stdout);
freopen_s(reinterpret_cast<FILE**>(stdin), "CONIN$", "r", stdin);
static std::ofstream conout("CONOUT$", std::ios::out);
std::cout.rdbuf(conout.rdbuf());

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

Expand Down

0 comments on commit 9d29b53

Please sign in to comment.