Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

How to set env. var from C program (Developers)

posted by RayeR Homepage, CZ, 15.01.2013, 04:34

I'm trying like idiot and nothing works.
I tried various functions like

int main(void)
{
  printf("putenv: %d\n", putenv("TEST1=123"));
  printf("sys: %d\n", system("SET TEST2=123"));
...clearenv, setenv
  return(0);
}

I can only read env. Funtions returns 0 = success but when I type set or env in shell I don't see new var. I tried DOS, win, linux - all the same. Do I need to call some extra function that flush env. changes to make it persistent? Or other way to do it? Uf going to bed now....

---
DOS gives me freedom to unlimited HW access.

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 233 users online (0 registered, 233 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum