How to access things like env vars, user name, etc.?

I need to access several environment variables such as location of Appdata folder, location of user’s home folder and username. How can I do this using C++ feature (values of these environment variables would be stored in game’s global variables)?

I need that as I’m going to store all levels in AppData so editor could work on player’s machine with user rights and game would still recognize content. I need also this to be in multiplatform way, so both Windows and Linux methods would be required, possibly with conditional compilation.