Jason,

I'm not exactly clear on a few things, including which "getenv," (just
referring to Linux here, right?)  which Delphi (?) you're using, etc.,  but
couldn't you use Delphi's and Kylix's built-in GetEnvironmentVariable(Name :
string) : string   function?  which calls the appropriate OS code
automatically for you?  (Nicely implemented in D7's SysUtils...  which I'm
looking at now. )

Or barring that, one can always use the Windows API functions
GetEnvironmentStrings, GetEnvironmentVariable ...


Seems quite easy to use the built-ins.  Here's the D7 version:

{$IFDEF MSWINDOWS}
function GetEnvironmentVariable(const Name: string): string;
const
  BufSize = 1024;
var
  Len: Integer;
  Buffer: array[0..BufSize - 1] of Char;
begin
  Result := '';
  Len := GetEnvironmentVariable(PChar(Name), @Buffer, BufSize);
  if Len < BufSize then
    SetString(Result, PChar(@Buffer), Len)
  else
  begin
    SetLength(Result, Len - 1);
    GetEnvironmentVariable(PChar(Name), PChar(Result), Len);
  end;
end;
{$ENDIF}
{$IFDEF LINUX}
function GetEnvironmentVariable(const Name: string): string;
begin
  Result := getenv(PChar(Name));
end;
{$ENDIF}

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to