In short: you can not .
In Windows, when compiling the program, indicate if it is in graphic mode or in console mode (if you do not do it, the compiler does it implicitly). If it is a program for console, the system creates a virtual console , which is the window that you see, so that your program interacts with it.
In non-Windows environments, such as * nix, things do not work that way. No there is distinction; all are programs, which interact with the standard input and output. These input / output mechanisms are not always physical ; a program can create a virtual console, and pass it as
STDOUT to other programs children .
That's the mechanism used by terminal emulators. Create a child process by calling the command interpreter. When you run a program under that interpreter, this other program inherits
STDOUT of the interpreter that launched it, which in turn inherits it from the program that created it, which, as I said, is the terminal application.
That mechanism makes different the auto-create a terminal window to show your results in it. You can invoke the emulator, passing an argument to it, which would be your own program to execute; from your own program, you have to differentiate if you have auto-invoked , or have been called directly. You could use the
/proc directory, or create some type of bolt file, or a socket network, or use DBUS , ...
Final advice: unless you need to create your own terminal for something, it is much easier to launch the programs from the terminal emulator provided by the system.