I have a C++ app and would like to run another process by its side
(multi-tasking).
I know C functions exist for this. I was wondering if C++ standard library has support for doing this in C++.
What C functions exist for this (seems like you're saying there's a cross-platform way to do this in C, but not C++, which doesn't make much sense to me)? Are you talking about the Unix functions?
Anyway, if you want to proper start a program, instead of using a bloated shell call, you gotta use your OS's API.
On Unix/Linux, you'd use something like the link I posted above.
On Windows, you'd use CreateProcess (also in the link above).
I do not know of a portable way.
system is not only dangerous, its not entirely portable .
that is, system (programname) won't work on unix without a .profile hack, otherwise you need system("./programname") because unix. There may be other dos/unix/other os syntax concerns if you try to port code with a system call. Its doable, but its crude, and you may need #ifdef string switcheroos on the command syntax. To be fair, I think the other methods may also have OS syntax adjustments; most of them take the same string args.
Spawning another process can lead to vulnerabilities no matter what mechanism is used to spawn the process. It is not just a single point vulnerability associated with the command processor alone. One just has to be careful; extra careful if your program is running with elevated privileges.
would like to run another process by its side (multi-tasking).
If you have two unrelated programs that you want to run, then you (the user) could start both. If clicking two icons is too taxing, then write a script that starts both applications.
If one program has to start an another, that implies that there is some data passed between the programs. That is more than just "How to start?".
C++ is not concerned about processes per se. OS is. Luckily(?) there is no one OS API to rule us all.
If you want a portable C++ interface, then look at third party. Perhaps Boost Process, Qt QProcess, ...