Access the structure HB_ITEM Harbour

Access the structure HB_ITEM Harbour

Postby xmanuel » Mon Nov 25, 2013 1:59 pm

Good for all.
See if someone can tell me how to access the internal structure of HB_ITEM Harbour (not xHarbour).
Specifically I want to access the address:
myItem->item.asString.length // NOTE, not the value but also the direction.

As an example:
myItem->item.asString.value;

I can access like this:
char *MyPointer = myItem->item.asString.value;
or function:
char *MyPointer = hb_itemGetCPtr(myItem) // This is the preferred

But myItem->item.asString.length, how?
There functions that do the same as hb_itemGetCPtr(myIyem) but myItem->item.asString.length?


///////////////// Español /////////////////////////

Buenas a todos.
A ver si alguien sabe decirme como acceder a la estructura interna de HB_ITEM en Harbour (no en xHarbour).

Concrétamente quiero acceder a la dirección de:
myItem->item.asString.length // OJO, no al valor si no a la dirección.

Como ejemplo:
myItem->item.asString.value;

puedo acceder así:
char * miPuntero = myItem->item.asString.value;
o con la función:
char * miPuntero = hb_itemGetCPtr( myItem ); // Esta es la aconsejable

Pero para myItem->item.asString.length, cómo?
Hay alguna función que haga lo mismo que hb_itemGetCPtr( myIyem ) pero para myItem->item.asString.length?

:D :mrgreen: :( :shock: :P :twisted: :?: :idea: :arrow:
______________________________________________________________________________
Sevilla - Andalucía
xmanuel
 
Posts: 762
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla

Re: Access the structure HB_ITEM Harbour

Postby MaxP » Mon Nov 25, 2013 3:35 pm

You ca try
ULONG hb_arrayGetCLen( myItem )

Regards
Massimo
User avatar
MaxP
 
Posts: 88
Joined: Thu Jul 12, 2007 2:02 pm

Re: Access the structure HB_ITEM Harbour

Postby Daniel Garcia-Gil » Mon Nov 25, 2013 3:45 pm

User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Access the structure HB_ITEM Harbour

Postby MaxP » Mon Nov 25, 2013 4:17 pm

Sorry,

this is the function

ULONG hb_itemGetCLen( myItem )

Regards
Massimo
User avatar
MaxP
 
Posts: 88
Joined: Thu Jul 12, 2007 2:02 pm

Re: Access the structure HB_ITEM Harbour

Postby MaxP » Mon Nov 25, 2013 4:46 pm

Example

Code: Select all  Expand view  RUN

#include "fivewin.ch"

function Main()
        LOCAL   nLen
       
        nLen := MyTest( "Example" )    
       
        MsgStop( nLen )    
RETURN NIL


#pragma BEGINDUMP

#include "hbapi.h"
#include "hbapiitm.h"


HB_FUNC( MYTEST )
{
        PHB_ITEM myItem = hb_itemNew(NULL) ;
        ULONG nRet ;
        const char *pStr = hb_parc(1) ;
       
        hb_itemPutC( myItem, pStr ) ;
       
        nRet = hb_itemGetCLen( myItem );
       
        hb_itemRelease( myItem );
       
        hb_retnl( nRet ) ;
}

#pragma ENDDUMP
 


Regards
Massimo
User avatar
MaxP
 
Posts: 88
Joined: Thu Jul 12, 2007 2:02 pm

Re: Access the structure HB_ITEM Harbour

Postby xmanuel » Mon Nov 25, 2013 7:39 pm

Gracias Massimo.
Realmente lo que pasa es lo que dice Daniel.

Yo no quiero saber el ancho sino la dirección del elemento que guarda...

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

Thanks Massimo.
Actually what happens is what Daniel says.

I do not want to know the width but the direction of the element that keeps ... :cry:
______________________________________________________________________________
Sevilla - Andalucía
xmanuel
 
Posts: 762
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 50 guests