mb_get_environment_var

Previous  Next

 

status_t mb_get_environment_var( mb_interpreter_t* s, LPCTSTR lpszName, mb_value_t* val )

 


 

Retrieve the value of a MyBASIC2 Environment Variable.    See Session and Environment Variables for a description of environment variables.

 

Example

 

/////////////////////////////////////////////////////////////////////////////

//

BOOL CFileBar::OnEndScript( mb_interpreter_t* s )

  {

  mb_value_t  val;

  CString     str;

 

  mb_get_environment_var( s, "MAXA$OPENED_FILES", &val );

 

  if ( val.type == MB_DT_INT )

     {

     for ( int i = 0; i < val.value.integer; i++ )

        {

        str.Format( "MAXA$OPEN_FILE_%d.FID", i + 1 );

        mb_del_environment_var( s, str );

 

        str.Format( "MAXA$OPEN_FILE_%d.STATUS", i + 1 );

        mb_del_environment_var( s, str );

        }

     endfor

 

     mb_del_environment_var( s, "MAXA$OPENED_FILES" );

     }

  endif

 

  return TRUE;

  }

endfunc