LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Is it possible to use system() and get the return value from the system call (https://www.linuxquestions.org/questions/programming-9/is-it-possible-to-use-system-and-get-the-return-value-from-the-system-call-216304/)

newguy21 08-11-2004 01:35 PM

Is it possible to use system() and get the return value from the system call
 
I wanted to do something like this:

buffer = system(/sbin/ifconfig eth0);

this isnt exactly what i'm doing but i have a script that when run from the prompt it returns the IPaddr of eth0. I would like the characters that usually are printed to the screen to be thrown into a local buffer in my C code. can this be done with system or should i use exec or anything else? Thank you in advance, I really appreciate all of your help.

infamous41md 08-11-2004 01:37 PM

man popen()


All times are GMT -5. The time now is 08:28 AM.