I have a console application that I need to do some checking of its command line arguments, I then need it to print some output and if everything is ok, fork into the background. I need this same behaviour in both Windows and Linux.
I know a lot of people argue against system, but what are the negatives of the following solution and how can I deal with them?
or exec family of functions implemented in CRT if you want to be cross-platform
Could you clarify for me how I can use these functions to get rid of my controlling terminal. I thought exec would just replace the current foreground process with another foreground process. I want a background process.
In Linux I would fork, return from the parent and exec in the child. But I don't believe Windows has a fork.
No, windows does not have fork().
I never use exec in windows anyway, but CreateProcess() can start a background process for sure (with or without waiting to end).