Re: Getting environment variables?

2013-05-02 Thread Mark Fischer
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:

Re: Getting environment variables?

2008-11-24 Thread Denis Koroskin
On Mon, 24 Nov 2008 16:53:20 +0300, Christopher Wright <[EMAIL PROTECTED]> wrote: John C wrote: novice2 Wrote: i am afraid that windows API named *W works with UCS2 string. but D wchar[] is UTF-16. Wrong - Windows has used UTF-16 as native since Windows 2000. Actually, you're both right

Re: Getting environment variables?

2008-11-24 Thread Christopher Wright
John C wrote: novice2 Wrote: i am afraid that windows API named *W works with UCS2 string. but D wchar[] is UTF-16. Wrong - Windows has used UTF-16 as native since Windows 2000. Actually, you're both right. UCS2 is UTF-16.

Re: Getting environment variables?

2008-11-24 Thread John C
novice2 Wrote: > i am afraid that windows API named *W works with UCS2 string. > but D wchar[] is UTF-16. Wrong - Windows has used UTF-16 as native since Windows 2000.

Re: Getting environment variables?

2008-11-23 Thread novice2
> Under what setups can the drive letter be a non-ASCII character? any non-english windows have folders, usernames, etc with non-ascii chars, therefore this names presents in environment, registry, file API etc. > wchar[] wpath; > wpath.length = GetEnvironmentVariableW("HOMEPATH", null, 0

Re: Getting environment variables?

2008-11-23 Thread Lars Ivar Igesund
torhu wrote: > Christopher Wright wrote: >> Hey all, >> >> How do I get environment variables in a D program? I specifically want >> the path to a user's home folder. >> >> Ta muchly. > > I think the 'correct' way on Windows is to use SHGetSpecialFolderPathA. > > Something like this: > > char

Re: Getting environment variables?

2008-11-23 Thread torhu
Christopher Wright wrote: Hey all, How do I get environment variables in a D program? I specifically want the path to a user's home folder. Ta muchly. I think the 'correct' way on Windows is to use SHGetSpecialFolderPathA. Something like this: char[MAX_PATH] buf; SHGetSpecialFolderPathA(n

Re: Getting environment variables?

2008-11-23 Thread Stewart Gordon
"novice2" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] homeDrive = toString(getenv("HOMEDRIVE")).dup; homePath = toString(getenv("HOMEPATH")).dup; don't forget, that D char[] is utf8 and windows char* is 8-bit chars, not utf8. so you should import std.windows.charset and

Re: Getting environment variables?

2008-11-23 Thread novice2
> homeDrive = toString(getenv("HOMEDRIVE")).dup; > homePath = toString(getenv("HOMEPATH")).dup; don't forget, that D char[] is utf8 and windows char* is 8-bit chars, not utf8. so you should import std.windows.charset and use toMBSz() as D->WindowsAPI and fromMBSz as WindowsAPI->D string c

Re: Getting environment variables?

2008-11-22 Thread BCS
Reply to Christopher, I thought (perhaps wrongly) C allowed you to declare main as taking a list of environment variables, It does.

Re: Getting environment variables?

2008-11-22 Thread Christopher Wright
Jarrett Billingsley wrote: On Sat, Nov 22, 2008 at 12:55 PM, Christopher Wright <[EMAIL PROTECTED]> wrote: Hey all, How do I get environment variables in a D program? I specifically want the path to a user's home folder. Ta muchly. In Tango, there's tango.sys.Environment (http://www.dsource

Re: Getting environment variables?

2008-11-22 Thread Stewart Gordon
"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-de

Re: Getting environment variables?

2008-11-22 Thread Jarrett Billingsley
On Sat, Nov 22, 2008 at 12:55 PM, Christopher Wright <[EMAIL PROTECTED]> wrote: > Hey all, > > How do I get environment variables in a D program? I specifically want the > path to a user's home folder. > > Ta muchly. > In Tango, there's tango.sys.Environment (http://www.dsource.org/projects/tango/

Getting environment variables?

2008-11-22 Thread Christopher Wright
Hey all, How do I get environment variables in a D program? I specifically want the path to a user's home folder. Ta muchly.