In continuation...

Pritpal Bedi wrote:
> 
> See, const char * szValue , is never sent and is NULL in C.
> Also I do not see how a variable gets removed from list in this code.
> I will be wrong if an empty value nullifies it.
> 

MSDN says 

If this parameter is NULL, the variable is deleted from the current
process's environment.

So, NULL deletes it. And hence the C code should be like:

#if defined( HB_OS_WIN )
   {
      LPTSTR lpName = HB_TCHAR_CONVTO( szName );
      LPTSTR lpValue = NULL;
      HB_BOOL bResult;

      if( ! ( szValue == NULL ) )
      {
         lpValue = HB_TCHAR_CONVTO( szValue );
      }
      bResult = ( SetEnvironmentVariable( lpName, lpValue ) != 0 );

      HB_TCHAR_FREE( lpName );
      if( lpValue != NULL )
         HB_TCHAR_FREE( lpValue );

      return bResult;
   }

It is not optimized, please check.

-----
     enjoy hbIDEing...
        Pritpal Bedi 
http://hbide.vouch.info/
-- 
View this message in context: 
http://harbour-devel.1590103.n2.nabble.com/hbMK2-Switch-env-RTE-tp5012018p5012072.html
Sent from the harbour-devel mailing list archive at Nabble.com.
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to