C process control#getenv
{{Short description|Functions of the C standard software library}}
{{Use dmy dates|date=January 2022}}
{{C Standard Library}}
C process control refers to a group of functions in the standard library of the C programming language implementing basic process control operations.{{cite book|last=Crawford|first=Tony|author2=Peter Prinz|title=C in a Nutshell|publisher=O'Reilly|location=§16.11 – Process Control|date=December 2005|pages=618|isbn=0-596-00697-7}}{{cite book | url=http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf | title=ISO/IEC 9899:1999 specification | at=p. 315, § 7.20.4 "Communication with the environment" | accessdate=25 November 2011}} The process control operations include actions such as termination of the program with various levels of cleanup, running an external command interpreter or accessing the list of the environment operations.
Overview of functions
The process control functions are defined in the stdlib.h
header (cstdlib
header in C++).
class="wikitable" style="font-size:0.85em"
! ! Function ! Description |
rowspan=6 | Terminating a program | {{anchor|abort}} | causes abnormal program termination (without cleaning up) |
---|
{{anchor|exit}}[http://en.cppreference.com/w/c/program/exit exit]
| causes normal program termination with cleaning up |
{{anchor|_Exit}}[http://en.cppreference.com/w/c/program/_Exit _Exit]
| causes normal program termination without cleaning up (C99) |
{{anchor|atexit}}[http://en.cppreference.com/w/c/program/atexit atexit]
| registers a function to be called on exit() invocation |
{{anchor|quick_exit}}[http://en.cppreference.com/w/c/program/quick_exit quick_exit]
| causes normal program termination without cleaning up, but with IO buffers flushed (C11) |
{{anchor|quick_exit}}[http://en.cppreference.com/w/c/program/at_quick_exit at_quick_exit]
| registers a function to be called on quick_exit() invocation |
rowspan=2 | Communicating with the environment | {{anchor|getenv}} | accesses the list of the environment variables |
{{anchor|system}}[http://en.cppreference.com/w/c/program/system system]
| calls the host environment's command processor |
References
{{reflist}}