process control and management

来源:百度文库 编辑:神马文学网 时间:2024/04/28 20:03:28
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()
execl()fork()wait()exit()
_xyz