I\'m using the system command in C++ to call some external program, and whenever I use it, a console window opens and closes after the command finishes.
It sounds like you're using windows.
On Linux (and *nix in general), I'd replace the call to system with calls to fork and exec, respectively. On windows, I think there is some kind of spawn-a-new-process function in the Windows API—consult the documentation.
When you're running shell commands and/or external programs, your program is hard to make platform-independent, as it will depend on the platform having the commands and/or external programs you're running.