Need some info

J

Jason Winters

How do you c to call system comands like df on linux or ipconfig form a c
program?
 
J

Jens.Toerring

Jason Winters said:
How do you c to call system comands like df on linux or ipconfig form a c
program?

Doesn't matter what OS you're using:

system( "df" );
system( "ifconfig" );

But I guess you don't actually want system() because you also want
to read what the command you invoked did return directly instead of
having to write it to a file first and then read in the file. In this
case the answer becomes system-dependent and thus off-topic here.
<OT>
But if you ask e.g. in comp.unix.programmer one of the answers you
will probably get is to use e.g. popen() and pclose() instead of
system() in this case.
</OT>
Regards, Jens
--
_ _____ _____
| ||_ _||_ _| (e-mail address removed)-berlin.de
_ | | | | | |
| |_| | | | | | http://www.physik.fu-berlin.de/~toerring
\___/ens|_|homs|_|oerring
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top