Hi
I am getting errno:10 No child process error while using system() command. I tried doing wait(NULL) in parent but could not get success.
Can you please suggest me a way to resolve this error. Its urgent.
Hey thanks....
Actually I'm using system() command to get the output of "df" command in child process but I'm getting error as "No child process".
I'm redirecting output of system() command to file and then reading from it in parent process. I tried using waitpid() in parent process. But it didn't help.
This code isn't complete (many variables like stat, prcfre, and pid are undeclared), so I imagine there are all sorts of things that might go wrong with those declarations; but I think the main problem is that the syntax for your df command is wrong. That "%s" looks like it's intended to be a replaceable parameter -- i.e., a format string for the sprintf() command. You're not replacing the parameter with anything, though, and so df is going to fail. The "no child process" could definitely come from that.
So do you want df to report the usage of a particular filesystem, or all filesystems, or what?