Mail Archives: djgpp/1997/06/12/11:39:58
On Thu, 12 Jun 1997, Ben N Shadwick wrote:
> It seems like there should be some kind of function to allow you to just
> browse through them all without knowing the name of each variable, in
> case you just want to look over what variables there are, but I don't
> recall any.
There is no such function, but you can examine the environment directly:
extern char ** environ;
char **ep = environ;
while (*ep)
{
char *evar = *ep;
/* Do whatever you like with this var */
ep++;
}
The elements of the `environ' array look like so:
"VAR=VALUE"
- Raw text -