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 hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net