getting return result from executing
Posted on 2004-09-13
Hi, I need to execute another program from within my program and capture the result. For example:
executing "bin/date +%H" will return "14" if it is 2 o clock
i need to capture the "14" into a variable int hr
i tried this:
but all that does is run the date program, output the "14" and then it does not return a value.
I know that execve does not return a value unless it fails.
What command can I use to execute another command and get the output of it?
Sorry so long.