RE: How to modify evironment variables in a C program

2002-03-11 Thread Burke, Thomas G.
Ah, OK then... -Original Message- From: Gordon Messmer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 11, 2002 1:32 PM To: [EMAIL PROTECTED] Subject: RE: How to modify evironment variables in a C program On Mon, 2002-03-11 at 09:53, Burke, Thomas G. wrote: > I would try usin

RE: How to modify evironment variables in a C program

2002-03-11 Thread Gordon Messmer
On Mon, 2002-03-11 at 09:53, Burke, Thomas G. wrote: > I would try using a system call in the C program. > > try > > ... > system("setenv foo bar"); > ... The system call is not passed on to the parent shell, it's run in a sub-shell. I don't believe it's at all possible to call setenv in a sys

Re: How to modify evironment variables in a C program

2002-03-11 Thread Gordon Messmer
eery" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, March 09, 2002 3:12 AM > Subject: Re: How to modify evironment variables in a C program > > > > > As designed. If any child program could alter the values of the > environment >

RE: How to modify evironment variables in a C program

2002-03-11 Thread Burke, Thomas G.
I would try using a system call in the C program. try ... system("setenv foo bar"); ... -Original Message- From: Xanh [mailto:[EMAIL PROTECTED]] Sent: Monday, March 11, 2002 12:49 PM To: [EMAIL PROTECTED] Subject: Re: How to modify evironment variables in a C program Tha

Re: How to modify evironment variables in a C program

2002-03-11 Thread Xanh
March 09, 2002 3:12 AM Subject: Re: How to modify evironment variables in a C program > > As designed. If any child program could alter the values of the environment > setting in their parent process, chaos could ensue. Imagine for a moment that > I convince you to play my game ca

Re: How to modify evironment variables in a C program

2002-03-10 Thread Alan Peery
Xanh wrote: > How do I export a change to an environment variable made in a C program? > $>export MyTest="Current Value" > $>./testenv > current value: Current Value > new value: New value here > $>echo $MyTest > Current Value > > The old value is retained. As designed. If any child

Re: How to modify evironment variables in a C program

2002-03-08 Thread fred smith
On Fri, Mar 08, 2002 at 06:23:15PM -0600, Xanh wrote: > Hello, > How do I export a change to an environment variable made in a C program? > I tried setenv() and putenv(), but the change is not visible to the shell. > > // testenv.c > int main(int argc, char* argv[], char* envp[]) > { >

Re: How to modify evironment variables in a C program

2002-03-08 Thread Statux
First thing I would do is check the return of p on the second call to getenv() ___ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list

How to modify evironment variables in a C program

2002-03-08 Thread Xanh
Hello, How do I export a change to an environment variable made in a C program? I tried setenv() and putenv(), but the change is not visible to the shell. // testenv.c int main(int argc, char* argv[], char* envp[]) { char* p; p = getenv("MyTest"); printf("current v