Hello Vailton,

It´s works fine :)

Many thank´s,

Rossine.


Vailton Renato wrote:
> 
> Hi!
> 
> I agree with Viktor that this type of access is not recommended
> because it represents a great risk to system stability. But just to
> illustrate, if you want to get the memory address of a particular
> variable (I do not see much use in it but ..) this is an example:
> 
> [TEST.PRG]
> #include "simpleio.ch"
> 
> FUNCTION Main
>      LOCAL a, b, c, d, e, f, g
> 
>      a := b := "A single text"
>      h := 'Other text'
> 
>      c := d := {}
>      e := ( @qqout() )
>      f := e
>      g := @date()
> 
>      cls
>      ? 'string ....:', _GETADDRESS(a), _GETADDRESS(b), _GETADDRESS(h)
>      ?
>      ? 'arrays ....:',_GETADDRESS(c), _GETADDRESS(d)
>      ?
>      ? 'pointer (1):', _GETADDRESS(e), _GETADDRESS(f)
>      ?
>      ? 'pointer (2):', _GETADDRESS(g), _GETADDRESS( @date() )
>      ?
>    RETURN NIL
> // end of file
> 
> [GETADDRESS.C]
> #include "hbvmopt.h"
> #include "hbapi.h"
> #include "hbapiitm.h"
> #include "hbstack.h"
> 
> HB_FUNC( _GETADDRESS )
> {
>    PHB_ITEM pItem = hb_param( 1, HB_IT_ANY );
>    char buffer[ 16 ];
> 
>    memset( buffer, 0, sizeof( buffer ) );
> 
>    switch( hb_itemType( pItem ) )
>    {
>       case HB_IT_ARRAY:
>          hb_snprintf( buffer, sizeof( buffer ), "%p", ( pItem
> )->item.asArray.value );
>          break;
> 
>       case HB_IT_STRING:
>       case HB_IT_MEMO:
>          hb_snprintf( buffer, sizeof( buffer ), "%p", ( pItem
> )->item.asString.value );
>          break;
> 
>       case HB_IT_SYMBOL:
>          hb_snprintf( buffer, sizeof( buffer ), "%p", ( pItem
> )->item.asSymbol.value->value.pFunPtr );
>          break;
> 
>       case HB_IT_POINTER:
>          hb_snprintf( buffer, sizeof( buffer ), "%p", ( pItem
> )->item.asPointer.value );
>          break;
> 
>       default:
>          hb_snprintf( buffer, sizeof( buffer ), "%p", 0 );
>          break;
>    }
> 
>    hb_retc( buffer );
> }
> 

-- 
View this message in context: 
http://old.nabble.com/Ask-Str2Poniter%28%29-and-Pointer2Str%28%29-function-pair-....-tp28042446p28072444.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to