how to get a console in a few simple lines of code in windows:
DWORD pid;
pid = GetCurrentProcessId();
AllocConsole();
AttachConsole(pid);
freopen("CON", "w", stdout);
printf("hello, i am the console\n");
update:
secure version:
DWORD pid;
pid = GetCurrentProcessId();
AllocConsole();
AttachConsole(pid);
FILE *streamfp = NULL;
freopen_s(&streamfp, "CON", "w", stdout);
printf("hello, i am the console\n");
DWORD pid;
pid = GetCurrentProcessId();
AllocConsole();
AttachConsole(pid);
freopen("CON", "w", stdout);
printf("hello, i am the console\n");
update:
secure version:
DWORD pid;
pid = GetCurrentProcessId();
AllocConsole();
AttachConsole(pid);
FILE *streamfp = NULL;
freopen_s(&streamfp, "CON", "w", stdout);
printf("hello, i am the console\n");