run application from another application

Say we have two main files generating two programs p1 and p2.

how can a third program call p1 or p2, which are already compiled?
system()

Though, you really should use an OS-specific function instead.
On Windows, use CreateProcess().

Good luck!
@duoas:

So in p3 you'd have to enter CreateProcess(p1) and CreateProcess(p2)?
Couldn't it be done by using #include p1.cpp or something like that?

Thanks :)
using a #include wouldn't work. All it would do is add all the functions in p1.cpp to the p3 file. #include in a sense is a glorified copy & paste. Also you shouldn't #include .cpp files (use header files), otherwise you're quite likely to run into building and linking errors. Use CreateProcess() like duoas said to start off one program from another
Ok, thanks for the explanation :)
Topic archived. No new replies allowed.