Return to Snippet

Revision: 1141
at September 16, 2006 16:27 by yuconner


Updated Code
// char * getenv(const char * name);
// int putenv(const char * var);

// getenv example
std::string HOME_PATH = getenv("HOME");

// putenv example
int stat = putenv("TEMP="/tmp");
if( !stat ) {
	cout<<"failed to define environment variable"<<endl;
}

Revision: 1140
at September 16, 2006 16:21 by yuconner


Initial Code
// char * getenv(const char * name);
// int putenv(const char * var);

// getenv example
std::string HOME_PATH = getenv("HOME");

// putenv example
int stat = putenv("TEMP="/tmp");
if( !stat ) {
	cout<<"failed to define environment variable"<<endl;
}

Initial URL

                                

Initial Description

                                

Initial Title
get and put environment variables in C++

Initial Tags

                                

Initial Language
C++