environment variable in linux gcc

This is a discussion on environment variable in linux gcc within the Linux Programming forums, part of the Platform Specific Boards category; Hi, I am able to get environment variable using getenv function in gcc.But when tried to change the value using ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    3

    environment variable in linux gcc

    Hi,
    I am able to get environment variable using getenv function in gcc.But when tried to change the value using setenv function, its value is changed as seen after calling getenv function. when try to seen the value of environment variable in command terminal in ubuntu. it is not showing any change. Can any one tell me, how can i change environment variable in linux gcc.


    ----------------
    Linux Learner

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    The shell is the parent process of your program.
    setenv() will only change the environment of your program but you can't change the environment of its parent, i.e. the shell.

    Bye, Andreas

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get environment variable
    By Bargi in forum Linux Programming
    Replies: 2
    Last Post: 10-16-2007, 06:42 AM
  2. How to set pointer for environment variable
    By spiky1 in forum C++ Programming
    Replies: 7
    Last Post: 08-18-2006, 05:19 PM
  3. how do i get the environment variable
    By Harman in forum C Programming
    Replies: 2
    Last Post: 05-09-2005, 10:51 AM
  4. Environment variable corruption
    By miclus in forum Linux Programming
    Replies: 7
    Last Post: 10-01-2004, 01:45 PM
  5. which linux environment should I use?
    By Dissata in forum Linux Programming
    Replies: 19
    Last Post: 10-02-2001, 06:45 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21