How to do 'export LANG=en" Using C


 
Thread Tools Search this Thread
Top Forums Programming How to do 'export LANG=en" Using C
# 1  
Old 04-11-2008
How to do 'export LANG=en" Using C

Hi
Could you please help me How to program Linux shell commands using C. I want set Language environment before start a particular application.

Example:-

export LANG=hi_IN.UTF-8
gedit

This will start Localized Hindi( Indian Language) version of the 'gedit', if the Hindi language pack and localized version of 'gedit' installed. But rest of the all applications and GNOME desktop will remain in English as my default language setting is English. This is what I want.

How can I program " export LANG=hi_IN.UTF-8 " using C language without going to shell prompt or without using shell script.

Please help

Ram Das
# 2  
Old 04-11-2008
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 01:03 PM.. Reason: Shell aside
# 3  
Old 04-11-2008
Hello era,

Defenetly helpfull this "putenv() or setenv()" .

Thank you.
Ram Das
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. HP-UX

install arabic lang

hi how to install arabic language and set it as default in hpux. also there is any website provide vm for hpunix for testing. (2 Replies)
Discussion started by: drpix
2 Replies

3. UNIX for Dummies Questions & Answers

How to Export Glance "Global System Calls" data to a file

Hello... I'm trying to setup a cronjob to record system data using glance at certain times of the day. My question is, how would one export the "Global System Calls" information to a file? Below is the command I have been using and it works to export CPU information. glance -f ... (0 Replies)
Discussion started by: fumus
0 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. UNIX for Dummies Questions & Answers

What is "/export" directory used for?

the question as this topic. (5 Replies)
Discussion started by: thsecmaniac
5 Replies

6. Shell Programming and Scripting

Command to view full data "export MAESTRO_OUTPUT_STYLE=LONG"

Hi, Always when I login to Unix, I need to give the following command to view the data properly; export MAESTRO_OUTPUT_STYLE=LONG The reason is that by default the settings export MAESTRO_OUTPUT_STYLE=SHORT Please let me know how I could make LONG as the default and avoid giving the... (1 Reply)
Discussion started by: jmathew99
1 Replies

7. Ubuntu

LANG=C not English?

On Ubuntu 7.04, why would the "C" LANG parameter not be English: $ LANG=C locale LANG=C LANGUAGE=he_IL:he:en_GB:en LC_CTYPE="he_IL.utf8" LC_NUMERIC="he_IL.utf8" LC_TIME="he_IL.utf8" LC_COLLATE="he_IL.utf8" LC_MONETARY="he_IL.utf8" LC_MESSAGES="he_IL.utf8" LC_PAPER="he_IL.utf8"... (4 Replies)
Discussion started by: dotancohen
4 Replies

8. Programming

export PS1='"\[\033[1;34m\]\T \d | System_Analyst.\[\033[0m\]'

Dear All, I have a problem with export. I would like to show a prompt on my shell but as I receive the export environment variable pointer it is the string. Like it is shown in the Title of this message How I can get the result of that command after execution in a string I mean I would like to... (6 Replies)
Discussion started by: mobile01
6 Replies

9. UNIX for Dummies Questions & Answers

Where to set the LANG variable

When I login to my AIX server, the LANG variable is automatically being set to En_US. This is causing locale warning messages when I run emacs or perl. The reason seems to be that En_US is not a valid locale (seen by running locale -a). I can change the variable from the command line (export... (3 Replies)
Discussion started by: wvdeijk
3 Replies

10. UNIX for Dummies Questions & Answers

Lang

Hi, I have LANG set to C.iso88591 what does this value mean and what other options do I have? The problem is that I am using mailx to send out reports. When the report arrives the email has a lot of details about a charecter set not being supported. I don't want to have a null value... (0 Replies)
Discussion started by: nhatch
0 Replies
Login or Register to Ask a Question