[Gambas-user] A fine afternoon for a good rant
Benoît Minisini
g4mba5 at gmail.com
Thu Feb 28 20:42:50 CET 2019
Le 28/02/2019 à 20:11, Cedron Dawg a écrit :
>
> /*--- Set the Return Array ????? Not sure this is right at all
> */
> void* theReturnArray;
> char* theListEntry;
> int f;
>
> GB.New( &theReturnArray, "String[]", NULL, NULL );
>
> for( f = 0; f < theFoundCount; f++ )
> {
> theListEntry = GB.NewString( theList[f], 0 );
> theReturnArray->Add( theListEntry );
> GB.Free( theListEntry );
> }
>
> GB.ReturnObject( &theReturnArray );
>
It's not right:
void* theReturnArray;
char* theListEntry;
int f;
GB.Array.New(&theReturnArray, GB_T_STRING, theFoundCount);
for( f = 0; f < theFoundCount; f++ )
{
theListEntry = GB.NewZeroString(theList[f]);
*((char **)GB.Array.Get(theReturnedArray, f) = theListEntry;
}
GB.ReturnObject( &theReturnArray );
Regards,
--
Benoît Minisini
More information about the User
mailing list