[fpc-pascal] set envirom variable with pascal in linux
Michael Van Canneyt
michael at freepascal.org
Tue Aug 30 11:13:30 CEST 2005
On Tue, 30 Aug 2005, mondrillo wrote:
> Hello list,
>
> In Bach, Perl, can do set SDL_VER=`sdl-config --version`
> and in enviroment has the variable SDL_VER=1.2.3 for example.
> echo $SDL_VER
> 1.2.3
> But in Pascal non have the setenv() procedure as in C :(
>
> Actualy I resolve this problem with sending the output to a file, and
> then reading the file. But, can I pass from C this function?, or call
> a libc (thinks is this lib that has setenv() ) from Pascal to execute
> setenv().
That will not work.
FPC has a copy of the environment, which it received on startup.
It makes little or no sense to add strings to this, since it is
for internal use only.
If you want to execute another program with a different set of
environment strings, you must use the execve call to specify a
different set of environment variables.
The TProcess component allows you to easily specify the
environment as a TStringList.
Michael.
More information about the fpc-pascal
mailing list