|
OpenZGY/C++ API and Internals (ALPHA)
Access seismic data stored in ZGY format.
|
#include <environment.h>
Static Public Member Functions | |
| static int | getNumericEnv (const char *name, int dflt=0) |
| Get value as a number. More... | |
| static std::string | getStringEnv (const char *name, const char *dflt=0) |
| Get value as a string. More... | |
| static void | putNumericEnv (const char *name, int value) |
| Convert number to string and store in the environment. | |
| static void | putStringEnv (const char *name, const char *value) |
| Store the supplied string in the environment. | |
Tiny helper class to access the environment variables of the process. Basically this is just a wrapper around getenv, but there are some Linux/Windows differences and it is a bad idea to duplicate that special handling too many places.
|
static |
Get value as a number.
Get an environment variable as a number. If the environment variable is missing or empty then the supplied default value is returned instead. If no default value was given then 0 is returned. Trailing garbage is ignored, so if the variable doesn't start with a digit the function silently returns 0. I.e. NOT the provided default value.
|
static |
Get value as a string.
Get an environment variable as a std::string. If the environment variable is empty or missing then the provided default value is returned. Or the empty string if there is no default. Attempting to distinguish between empty and missing variable is not portable. So this function won't let you. An environment variable with an empty name is always consdered unset.
1.8.17