Unformatted text preview: ng “name=value”. If found, it returns a pointer to value, otherwise it returns NULL.
#include <stdlib.h> int setenv(const char *name, const char *newvalue, int overwrite);
returns: 0 on success, -1 on error. void unsetenv(const char *name);
returns: nothing. If the environment array contains a string of the form “name=oldvalue” then unsetenv deletes it and setenv replaces oldvalue with newvalue, but only if overwrite is nonzero. If name does not exist, then setenv adds “name=newvalue” to the array.
Aside: Setting environment variables in Solaris systems Solaris provides the putenv function in place of the setenv function. It provides no counterpart to the unsetenv function. End Aside. Aside: Programs vs. processes. This is a good place to stop and make sure you understand the distinction between a program and a process. A program is a collection of code and data; programs can exist as object modules on disk or as segments in an address space. A process is a speciﬁc instance of a program in execution; a program always runs in the context of some process. Understanding this distinctio...
View Full Document