Retorno de matriz de C a Harbour

Retorno de matriz de C a Harbour

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

Ayuda, en Linux con FiveLinux y Harbour

t:=fEstructura_Tabla()
msgalert(len(t)) <--------- Retorno 2
msgalert(t[1]) <--------- Retorna NIL en vez de "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: Retorno de matriz de C a Harbour

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

Replace with an example given by 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: 170
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 0 guests