I dont understand can u plz explain.. i want my c++ program to open it but stay in same window.
Consider this. Where does the C++ program output go? In a console program, that means that each program has its own console. The console is an interface that allows someone to type in it (input), and read from it (output). There’s a bunch of startup code that will automatically setup your program with a console, and connect the output and input appropriately.
When you run another program, it too will get its own console, and be connected to that console’s output and input. “Stay in the same window” is a nebulous concept. It actually doesn’t make sense, as you have two separate programs, and so two separate consoles. What you probably mean is you want to see the output of that second program in your calling program.
You can’t use the system function for this. You can read about it on Google, but suffice to say, it’s a crude way of getting the OS to run something on the command line.
You’ll have to look into Windows API specific functions for opening a program, and then for piping that program’s output to your console window.
If you aren’t at the level of C++ that you can handle reading WinAPI documentation, then what you’re trying to do is far too complicated for you right now.