Created
June 3, 2022 17:47
-
-
Save josephcsible/f4dc0ca94adb41de1df358ed150d0c9b to your computer and use it in GitHub Desktop.
Write to the parent's console regardless of process creation flags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
#include <stdio.h> | |
int main(void) { | |
FreeConsole(); | |
AttachConsole(ATTACH_PARENT_PROCESS); | |
freopen("CONOUT$", "w", stdout); | |
puts("This will go to the parent's console no matter what process creation flags were used"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment