Consider the following program:

{$mode objfpc}{$H+}

uses
  SysUtils;

var
  i: integer;
  s: string;

begin
  i := GetEnvironmentVariableCount;
  writeln('VariableCount: ',i);
  s := GetEnvironmentString(1);
  writeln('Variable 1: ', s);
  s := GetEnvironmentString(2);
  writeln('Variable 2: ', s);
  s := GetEnvironmentVariable('=D:');
  writeln('Variable 1: ', s);
end.

If I run this from a command prompt on my windows 2000 computer it gives the following output:
VariableCount: 43
Variable 1: =D:=D:\lazarus\bugs\7699
Variable 2: =ExitCode=00000000
Variable 1:

The first two envrionment string are special, in the sense that their name start with a =.

but if ask for the value of the environment variable '=D:', it returns the empty string.

I am wrestling a bit with how to interprete this. Should I consider these variable as special and hidden and ignore them? Or should code parsing environmentstrings be able to handle variables with a '=' on the first position?

Vincent
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to