How to get exit value of an executable that gets called from function?

How to get exit value of an executable that gets called from function?

I have an executable called �myexec� which returns 0 on success and different values for different fail scenarios.

I need to call this (myexec) executable from �myprog()� function of other executable and get the exit value (return value) of it. I tried with �system()� call but it doesn't returns the exit-value of �myexec�.

Is there any other way to solve my problem??

Thanks in advance,

Regards,
SureshReddi.

Thanks Driver it works for me.