August 2011
Intermediate to advanced
552 pages
23h 48m
English
Another way to influence program behavior is through environment variables. Environment variables, such as those in Figure 4.2, are key-value pairs that are under user control via the shell. The getenv() function is used to read the variables the user has set (directly or indirectly) in the environment from which your program has been run.
Figure 4.2 Environment variables

Supply getenv() with the name of the environment variable you want. If the variable does not exist in the environment, you get NULL back. If it does exist, you will get back a string with the value. The system owns the memory for the string returned ...
Read now
Unlock full access