Getting environment variables?

Mark Fischer marqfischer at yahoo.com
Thu May 2 15:13:22 PDT 2013


Better late than never...

On Sunday, 23 November 2008 at 02:28:30 UTC, Christopher Wright
wrote:
...
> I thought (perhaps wrongly) C allowed you to declare main as 
> taking a list of environment variables, which is why I asked

Indeed, on Unix { not POSIX } and Windows:

 From Wiki:
======================
Other platform-dependent formats are also allowed by the C and
C++ standards, except that in C++ the return type must always be
int;[3] for example, Unix (though not POSIX.1) and Microsoft
Windows have a third argument giving the program's environment,
otherwise accessible through getenv in stdlib.h:

int main(int argc, char **argv, char **envp);

Mac OS X and Darwin have a fourth parameter containing arbitrary
OS-supplied information, such as the path to the executing
binary:[4]
======================

Mark
~~~~


More information about the Digitalmars-d-learn mailing list