Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.sao.ru/hq/sts/linux/book/c_marshall/subsection2_18_4_1.html
Дата изменения: Unknown
Дата индексирования: Sat Sep 11 20:23:49 2010
Кодировка:

Поисковые слова: south pole
Running UNIX Commands from C



Next: execl() Up: Process Control and Management Previous: Process Control and Management

Running UNIX Commands from C

We can run commands from a C program just as if they were from the UNIX command line by using the system() function. NOTE: this can save us a lot of time and hassle as we can run other (proven) programs, scripts etc. to do set tasks.

int system(char *string) - where string can be the name of a unix utility, an executable shell script or a user program. System returns the exit status of the shell.

Example: Call ls from a program

system is a call that is made up of 3 other commands: execl(), wait() and fork()



Dave.Marshall@cm.cf.ac.uk
Wed Sep 14 10:06:31 BST 1994