problem while setting putenv


 
Thread Tools Search this Thread
Top Forums Programming problem while setting putenv
# 1  
Old 09-02-2007
problem while setting putenv

Hi, I m trying to change the env variable from the c program which inturn calls another c executable. i m using the putenv function but it does not set the value as required , it overwrites the values with some other values...

i m using following cmd's to set the env variable FULL_PATH :

sprintf(file_path,"FULL_PATH=%s",new_file_full_path);
status = putenv(file_path);
# 2  
Old 09-02-2007
How are you executing the child program? fork/exec, system?

Is the environment only corrupted in the current process or the child processes?

The exec family of functions allow you to pass all the environment variables explicitly.
# 3  
Old 09-03-2007
child program is executing using system() command. but the env variables gets corrupted in the current process itself.
# 4  
Old 09-03-2007
what happens if you do

Code:
putenv("VARIABLE=value");
system("echo $VARIABLE");

Code:
putenv("VARIABLE=value");
system("set");

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

Problem setting up wireless mouse

Did not know where to post this. Could someone help me with getting my wireless mouse to work? I can post more specifics at that time. Thanks. (9 Replies)
Discussion started by: drew77
9 Replies

2. Ubuntu

Backup setting problem

the way that i use to backup my server is using the script below in ssh. mysqldump --opt -Q -u username -p password > /var/www/squiro/sql/database.sql but i want to set the server backup everyday at 1pm in same folder. is that set it in crontab-e? how to set it? (3 Replies)
Discussion started by: mampwamp
3 Replies

3. Solaris

Problem in setting up printers

Hi, We are facing an issue while setting up printers in solaris 5.10 . We have Oracle EBS installed over it. We have configured the printer and when we try printing a page from EBS it is printing fine. But the problem arises when we print two copies of the page. The first page is printing fine... (5 Replies)
Discussion started by: Srinathkiru
5 Replies

4. UNIX for Advanced & Expert Users

Setting Ulimit problem

I changed the standard Ulimit sometime back. But when I change it back, the setting does not get updated. How do I make the change permanent Waitstejo (7 Replies)
Discussion started by: Waitstejo
7 Replies

5. Shell Programming and Scripting

Problem setting environment...

Hi All I'm attempting to automate the process of setting the DISPLAY environment variable when logging on (sourcing the .cshrc). I have a mixture of linux and solaris servers and this comnand: who -m | awk '{ print $6}' | tr -d '()' seems to work on all the servers. I want... (2 Replies)
Discussion started by: huskie69
2 Replies

6. Solaris

putenv() doesnt really export the variable

Hi, I am trying to export LD_LIBRARY_PATH variable using putenv() in my code. but when executing the binary, it still prompts for the necessary libraries. But when I export the LD_LIBRARY_PATH from command prompt using export, the binary is able to link to the libraries. Where am I going wrong? (3 Replies)
Discussion started by: bhanug
3 Replies

7. Web Development

Problem setting up apache

Hello there, I installed Ajaxterm on my Ubuntu 9.04 machine, and it's running ok if I use : http://localhost:8022/ in my browser. The problem is that I wanted to be able to acces it from somewere else through the internet. I read some instruction and help sites related to this problem, like :... (2 Replies)
Discussion started by: spiriad
2 Replies

8. UNIX for Dummies Questions & Answers

Problem setting up dual boot

Hi, I am trying to set up a dual boot system with Red Hat EL 5.2 and Windows XP Pro. I have a separate disk for each OS. Grub is on the same disk as redhat(the primary disk). I know that Windows is installed correctly because if I force a load on the secondary disk Windows loads correctly.... (0 Replies)
Discussion started by: adawg1217
0 Replies

9. Solaris

Problem Setting $PATH

I am trying to install the pkg-get package to a fresh install of Solaris 10. I am able to download and install correctly using the default directory for both pkg-get and wget as found on blastwave.org. When I issue the command "which wget and which pkg-get" it returns no wget or pkg-get found in... (1 Reply)
Discussion started by: greengrass
1 Replies

10. Shell Programming and Scripting

Is this a shell setting problem?

I have a question regarding shell settings. I have one Sun server with Solaris 9 and Oracle 10g R2 on it. DB is up running well. I created a script to start DB automatically when server reboot. It didn't work. I manually run dbstart under $ORACLE_HOME/bin, the server return message like:" dbstart:... (7 Replies)
Discussion started by: duke0001
7 Replies
Login or Register to Ask a Question