exporting variables
hello
I need to export from an app an environment variable, so a script could see it's value. Actually i need to comunicate a scalar value from the app to the script (i.e. app is processing some tables from a database, and i need to know from the script, which table is being processed). I tried something like: putenv((char *)(nr_tbl_s.str()).c_str()); system("export tbl"); but it didn't work ... please help |
The shells (bash and ksh at least) do "export VAR=VALUE" so it appears your "system(export tbl)" is wrong - it would need to be "system(export tbl=VALUE)" assuming you want the shell to see a variable named "tbl" (as opposed to "tbl" being a variable within C). Unfortunately I don't know enough about C to tell you how to get C variable as the shell variable but did want to make a note on the proper usage of the shell "export" facility you're calling.
|
thanks, jlightner !
|
All times are GMT -5. The time now is 03:59 AM. |