473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

problems with function system

Hi,

I have some problems with invoking a shell script out of a c++ program.
The shell script is setting paths with "export PATH=/home/test/gcc/" .

When within my program I use
"string sysCall = "source " + locationOfScrtip;"
[locationOfString is a string containing the location of the script] and
"system( sysCall.c_str() );"

the paths are not set. When I run the script in bash with
"source pathToScrtip" the paths are set correctly .
Any ideas how to solve that problem?

Thanks
Chris
Jul 23 '05 #1
1 1370
Christian Christmann wrote:
The shell script is setting paths with "export PATH=/home/test/gcc/" .
When within my program I use
"string sysCall = "source " + locationOfScrtip;"
[locationOfString is a string containing the location of the script] and
"system( sysCall.c_str() );"
the paths are not set. When I run the script in bash with
"source pathToScrtip" the paths are set correctly .
Any ideas how to solve that problem?


The usual way to use the environment in the operating systems is: each
process has his own environment, when creating a process his environment is
created by copying from the parent, when the child finishes his environment
is destoyed.

Your script sets the environment of the child process that runs int, it does
not touch the environment of the process that is running your program.

Or in a shorter way: you can't do that.

--
Salu2
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Justin Lemkul | last post by:
Hello all, I am hoping someone out there will be able to help me. I am trying to install a program that utilizes NumPy. In installing NumPy, I realized that I was lacking Atlas. I ran into...
2
by: Jose Meireles | last post by:
Hi everyone I've created a module (in a web app) to hold several generic functions as subroutines. The problem I face is that I've got problems with the call of system functions with wich I...
9
by: Eva | last post by:
Hi, I wanted to know how i can enter values into a specific column of a listview. I have tried the following code but this seems to enter all my values into the first column!!! Can anyone...
3
by: Narayan Appachar | last post by:
Hi, We were able to build stored procedures without any problems till now. Now while building procedures, we are getting the following errors ------------------------------------------ Create...
2
by: Tomas Vera | last post by:
Hello All, I'm having problems creating a page with dynamic checkboxes in a WebApp. In my app, I need to query a database, then (based on results) add checkboxes to my form and set their...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
21
by: matvdl | last post by:
I have a system that was originally developed in asp - the pages are saved in SQL (there are over 10,000 pages) and saved to a temp directory in the server when requested by a client. I have...
1
by: nate axtell | last post by:
In VB .Net I made a custom CheckBox column style (for the Datagrid control) that maps to two DataTable columns , one it uses for the Checked status and the other it uses for the Enabled status. I am...
1
by: Bob | last post by:
Hi, Hope you can help me with this one. I'm at my wits end. I'm trying to create an intelligent edit-box like the excellent "Customer" one at the URL: ...
9
by: =?Utf-8?B?SG93YXJkIFNtaXRo?= | last post by:
I am using VC++ 6.0 (with SP5 installed). When using WinXP this is with SP2 installed. I am developing an instrumentation system comprising a set of networked PCs connected using TCP/IP TCP links....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.