Return to Harbour matrix C

Return to Harbour matrix C

Postby jgayoso » Thu Aug 28, 2014 8:50 pm

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: 167
Joined: Sat Aug 07, 2010 11:36 pm
Location: Chile

Re: Return to Harbour matrix C

Postby jgayoso » Thu Aug 28, 2014 9:27 pm

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
jgayoso
 
Posts: 167
Joined: Sat Aug 07, 2010 11:36 pm
Location: Chile


Return to FiveLinux / FiveDroid (Android)

Who is online

Users browsing this forum: No registered users and 1 guest