Answers for "using environment variables c++"

C++
1

c++ main environment variables

// the third parameter (envp) is a NULL terminated array of NULL terminated strings
int main(int argc, char **argv, char **envp)
{
  for (char **env = envp; *env != 0; env++)
  {
    char *thisEnv = *env;
    printf("%s\n", thisEnv);    
  }
  return 0;
}
Posted by: Guest on December-21-2020
0

c++ get environment variable

#include <stdlib.h> 

int main() {
  std::string pathVar = getenv("PATH");
  return 0;
}
Posted by: Guest on August-20-2021

Code answers related to "using environment variables c++"

Browse Popular Code Answers by Language