Boost logo

Boost Users :

From: Aaron Griffin (aaronmgriffin_at_[hidden])
Date: 2006-01-19 19:36:51

On 1/19/06, Merrill Cornish <merrill.cornish_at_[hidden]> wrote:
> Is there a Boost way to get environment variables? I _thought_
> I had seen a reference to that in the program options libarary,
> but I can't find it now.
> Merrill

How about:
std::string get_env(std::string const& name)
   char* var = getenv(name.c_str());
   //getenv can return NULL, std::string(NULL) throws
   if(var) return var;
   else return "";

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at