I am trying to write a program using C++ that can start the stopped jobs in the foreground and background (as if & were used) in Linux/Unix but I am pretty lost on the direction I should take. I am relatively new to C++ programming so any and all help is appreciated. Thanks in advance.
That sounded interesting, but with about 45 minutes of searching around it's starting to sound pretty difficult.
fg and bg (the programs that already exist that do this job) http://www.linuxquestions.org/questions/linux-general-1/source-code-for-fg-bg-command-774427/
Both of these programs are what they call builtins, which means that they are actually part of the bash shell. You would have to check the actual source of BASH. I don't think there is any kind of API available for bash, but I'm certainly not an expert there. You might be stuck with tracking down the functions behind 'fg' and 'bg' and you might find that they only work if they are compiled with the entire bash program. Bash source ->https://www.gnu.org/software/bash/
kill/killall/ps - these and more are part of the GNU Core Utils package, the source is at https://www.gnu.org/software/coreutils/coreutils.html and they tend to run through /proc to do what they do. I haven't looked deeply into the source yet, but I don't think it's going to shed much better light on your question at this point.
Sorry, I'm out of time for now, hope you have better luck.