"Christopher Wright" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hey all,
How do I get environment variables in a D program?
std.c.stdlib.getenv
http://www.cplusplus.com/reference/clibrary/cstdlib/getenv.html
I specifically want the path to a user's home folder.
Platform-dependent.
For Windows, you can use the concatenation of HOMEDRIVE and HOMEPATH, but I
don't know under which versions of Windows these variables are actually set.
----------
import std.c.stdlib, std.string, std.stdio;
void main() {
string homeDrive, homePath;
homeDrive = toString(getenv("HOMEDRIVE")).dup;
homePath = toString(getenv("HOMEPATH")).dup;
writefln("%s%s", homeDrive, homePath);
}
----------
For Unix, I'm informed that the HOME environment variable does it.
http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2005-09/0092.html
HTH
Stewart.
--
My e-mail address is valid but not my primary mailbox. Please keep replies
on the 'group where everybody may benefit.