How to code that system call? Thanks

Y

yezi

HI:

I have different string which include different command in linux like "
ls -al" or "date" or "whereis filename", according to the string, the
code supposed to system call the function, how to code ?

Any comments is appreciated.

Thanks
 
M

Mike Wahler

yezi said:
HI:

I have different string which include different command in linux like "
ls -al" or "date" or "whereis filename", according to the string, the
code supposed to system call the function, how to code ?

Any comments is appreciated.

#include <stdlib.h>

int main()
{
system("ls -al");
return 0;
}

-Mike
 

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

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,108
Latest member
AlbertEste
Top