The equivalent C function would be getenv().
--
*************************************
Duncan A. Groenewald [IVS]
dun...@iafrica.com
*************************************
Here's my GetEnv:
function GetEnv(const Name: String; const Default: String): String;
var
Tag: array[0..64] of Char;
TagLen: Integer;
p1: PChar;
PosEqual: PChar;
begin
Result := Default;
StrPCopy(Tag, Name);
TagLen := Length(Name);
p1 := GetDOSEnvironment;
while p1^ > #0 do begin
PosEqual := StrPos(p1, '=');
if PosEqual <> Nil then begin
if StrLIComp(p1, Tag, TagLen) = 0 then begin
Result := StrPas(PosEqual + 1);
break;
end;
end;
Inc(p1, StrLen(p1) + 1);
end;
end;
Usage:
ThePath := GetEnv('PATH', 'C:\windows');
will retrieve the DOS environment assigned to PATH or return the default in
the second param if the first param is not an environment variable. First
param is case-insensitive.
For D2, I think you use GetEnvironmentVariable.
-Kirk
------------------------------------------------
Kirk B. Spadt ksp...@keyware.com
Keyware Systems, Inc.
570 Lindsey Drive (610) 964-9530
Radnor, PA 19087 (610) 964-0543 fax