3 ms·
Ah, I see. I finally get it: cmd.exe must be running for the *ConsoleOutput API calls to work. I don't have the specifics for POSIX pipe redirection, but I do
by i336_ 10y ago
Ah, I see.
I finally get it: cmd.exe must be running for the *ConsoleOutput API calls to work.
I don't have the specifics for POSIX pipe redirection, but I do know that you use dup2() to redirect everything appropriately. Oh... as for actually launching a terminal, yeah, that's insane. Or rather it has an insane history.
- to3m 10y agoNo, the console window is separate from cmd - it's a builtin Windows thing. If your Windows program (that isn't cmd) needs a console, and it doesn't have one, it can call AllocConsole(), and one will be added for it. (A new console window will appear with your program's EXE's path in the title bar.) If your program is tagged as a console program, Windows will usually open a console for it when run - or, at its parent process's discretion, it can be made to use the parent's console. This is how cmd.exe gets a window when you run it from Explorer, and it's how cmd /k runs the new cmd inside the same window when you run it from cmd itself.
- JdeBP 10y agoNo. A command interpreter is not a console. * http://jdebp.eu./FGA/a-command-interpreter-is-not-a-console.html http://jdebp.eu./FGA/a-command-interpreter-is-not-a-console....