Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-11-2004, 01:35 PM   #1
LQ Newbie
Registered: Jul 2004
Posts: 8

Rep: Reputation: 0
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.
Old 08-11-2004, 01:37 PM   #2
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
man popen()


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Retain Server Connection Up, If Client Break, write system call return SIGPIPE anandss2004 Programming 2 10-24-2005 12:16 AM
How to use return values from system functions? kpachopoulos Programming 2 07-30-2004 03:09 AM
How can get values return from a system call quenn Programming 1 09-16-2003 11:05 PM
about system call alchen1999 Programming 10 09-01-2003 03:43 AM
Using the "system( )" system call causes exit sometimes AbhiShek Linux - Software 6 10-01-2002 02:56 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:13 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration