Skip to content

Instantly share code, notes, and snippets.

@josephcsible
Created June 3, 2022 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josephcsible/f4dc0ca94adb41de1df358ed150d0c9b to your computer and use it in GitHub Desktop.
Save josephcsible/f4dc0ca94adb41de1df358ed150d0c9b to your computer and use it in GitHub Desktop.
Write to the parent's console regardless of process creation flags
#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