NO

Author Topic: environ  (Read 4381 times)

czerny

  • Guest
environ
« on: April 29, 2008, 10:07:44 PM »
I need access to the program environment (not with getenv() etc., but the adress)
The following crashes:
---------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>

int main(int argc, const char *argv[], const char *envp[]) {
   size_t i;
   if (envp != NULL) {
      for (i = 0; envp != NULL; i++) {
         puts(envp);
      }
   }
   return 0;
}
-----------------------------------------------------------

Is there a variable like 'environ' pointing to the global environment?

czerny

czerny

  • Guest
Re: environ
« Reply #1 on: April 30, 2008, 11:16:11 AM »
Under POSIX I think the following is defined:

extern char **environ;

Under Pelles C there is nothing with this name. Is there something equivalent?

czerny

Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: environ
« Reply #2 on: April 30, 2008, 03:35:18 PM »
best regards
 Alex ;)