Return to Harbour matrix C

Post Reply
jgayoso
Posts: 170
Joined: Sat Aug 07, 2010 11:36 pm
Location: Chile

Return to Harbour matrix C

Post by jgayoso »

Help in Linux with FiveLinux and Harbour


t:=fEstructura_Tabla()
msgalert(len(t)) <----- Return 2
msgalert(t[1]) <-----Returns NIL instead of "nombre"


# pragma BEGINDUMP

#include <hbapi.h>

HB_FUNC (FESTRUCTURA_TABLA)
{
const char* cNombreCampo = "nombre";
const char* cValor = "jorge";


hb_reta( 2 ); // creamos y devolvemos un array de 2 elementos.
hb_storc(cNombreCampo,1); //Se llena elemento 1
hb_storc(cValor,2); //Se llena elemento 2
}
# pragma ENDDUMP
jgayoso
Posts: 170
Joined: Sat Aug 07, 2010 11:36 pm
Location: Chile

Re: Return to Harbour matrix C

Post by jgayoso »

Cambie por un ejemplo entregado por Antonio Linares

#pragma BEGINDUMP

#include <hbapi.h>
#include <hbapiitm.h>

HB_FUNC( FESTRUCTURA_TABLA )
{
PHB_ITEM pArray = hb_itemNew( NULL );

hb_arrayNew( pArray, 4 ); // 4 elements

hb_arraySetC( pArray, 1, "Hello" ); // a string
hb_arraySetNL( pArray, 2, 123 ); // a number
hb_arraySetL( pArray, 3, 1 ); // a logical
hb_arraySetDL( pArray, 4, 11223344 ); // a date

hb_itemCopy( hb_param( 1, HB_IT_ANY ), pArray );
hb_itemRelease( pArray );
}
#pragma ENDDUMP
Post Reply