The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 04-11-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,632
To set an environment variable from C, use putenv() or setenv()

As an aside, in the shell, if you only want to set or change the variable for one command but otherwise keep it as it is, the export is superfluous.

Code:
LANG=hi_IN.UTF-8 gedit
will start gedit with LANG set to that value without affecting its value in the current shell or other commands started from it.

Last edited by era; 04-11-2008 at 09:03 AM. Reason: Shell aside
Reply With Quote