Logo

Programming-Idioms

History of Idiom 205 > diff from v7 to v8

Edit summary for version 8 by phrank:
New C implementation by user [phrank]

Version 7

2019-09-29, 19:52:51

Version 8

2019-09-29, 20:58:10

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Idiom #205 Get an environment variable

Read an environment variable with the name "FOO" and assign it to the string variable foo. If it does not exist or if the system does not support environment variables, assign a value of "none".

Extra Keywords
envvar os system
Extra Keywords
envvar os system
Imports
#include <stdlib.h>
Code
const char * foo = getenv("FOO");
Comments bubble
Returns a pointer to the value or NULL
Doc URL
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getenv.html