1. What is the difference between the system and exec family of functions?
2. I want to collect the output of the call from the system functions say. Say I execute this
system("date");
Now say I don't want it to display the output rather it give the output as an array of strings which I can try to analyze. Java has some functionality where it creates some Process instance and then get the input/outputstream which can be analyzed. I guess python/ruby/perl even bash shell scripting has similar facility where you type some command within `and ` that can be assigned to some variable to be analyzed later on. So something in this line of work. Is there any sort of functions other than those two mentioned above which can be used to have similar effects?
3. Why do we get only 2 processes after calling fork? I mean why they design it like that? Why can't we get a parent process and a couple of child processes? Why didn't they think of creating more than 2 processes?