Enumerate environment variables in C++ (cross-platform)

c++, cross-platform, environment-variables

Solution

It seems like you're just looking for the 3rd argument to main, a char** of process environment variables.

Here ya go: Main function

The prototype for that form is `int main(int argc,char** argv,char** env)`

Problem

Just a quick question and I hope that hasn't been asked before. I want to know a way to list all the assigned environment variables for a process. I need it to be cross-platform across Windows and UNIX-like operating systems. I know `getenv()` but that only retrieves a variable's value. I need to generate a list of them. Thank you for help!

Original source

Related problems