Next: Piping in a C program Up: Running UNIX Commands from C Previous: wait()

exit()

int exit(int status) - terminates the process which calls this function and returns the exit status value. Both UNIX and C (forked) programs can read the status value.

By convention, a status of 0 means normal termination any other value indicates an error or unusual occurrence. Many standard library calls have errors defined in the sys/stat.h header file. We can easily derive our own conventions.

A complete example of forking program is in Appendix and is originally titled fork.c


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