RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

getenv C Runtime Function Print E-mail
User Rating: / 0
PoorBest 
Written by Chamara Withanachchi   

Retrieves a C string containing the value of the environment variable whose name is specified as argument. If the requested variable is not part of the environment list, the function returns a NULL pointer.


The string pointed by the pointer returned by this function shall not be modified by the program.


The same memory location may be used in subsequent calls to getenv, overwriting the previous content.


Ex:

    H BNDDIR('QC2LE')

     D getenv          PR              *   extProc('getenv')
     D  envVar                         *   Value Options(*STRING)
     D userAddr         S            15A
      /free
          userAddr = %str(getenv('REMOTE_ADDR'));
      /endif
<Previous   Next>