[so] [Linux] Comportament ciudat variabile de mediu

ana-maria lepar amylepar at gmail.com
Sat Mar 28 22:42:13 EET 2009


Salut,

Am rulat urmatorul program (banal) :

==============================
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char** argv){
        char * rez ;
        rez = getenv(argv[1]+1);
        printf(" %s \n", rez);
        return 0;
}
===============================
la rulare :
so at elmer:~/teme/tema1_linux/teste_moi$ ./a.out $HOME
 (null)
===============================
nu imi afiseaza deloc variabila de mediu
daca rulez in consola echo $HOME imi da rezultatul corect :

===============================
so at elmer:~/teme/tema1_linux/teste_moi$ echo $HOME
/home/so
===============================

Sistemul de operare : Linux  - Debian Etch .

Poate sa imi explice cineva care este cauza acestui compotament ciudat?

Multumesc.
Ana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/so/attachments/20090328/376b2f91/attachment-0001.htm>


More information about the so mailing list