php source q's reverse...
| From: | Simon | Date: | Wed, 27 Jul 2005 16:38:40 +0000 |
| Subject: | php source q's reverse... | ||
| References: | 1 2 3 4 5 6 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-1475@lists.php.net to get a copy of this message | ||
Hi, thanks for the help Andrei , I am getting there with set_artists, documenters & authors ... so now the reverse of my previous question .. converting a gtk array of strings into a php array ?
The below will return an array if I populate it manually so I am mostly there apart from converting the gchar list items into a string to add to the returned array , I found
cp_ret = phpg_from_utf8(php_retval, strlen(php_retval), &cp_len, &free_result TSRMLS_CC);
elsewhere but that gives me empty strings (or I am populating the array incorrectly.
also how can I iterate though the gchar list ?
/****************************************************/
static PHP_METHOD(GtkAboutDialog, get_artists)
{
gchar *list, *cp_ret;
zval *item;
unsigned int i=0;
const gchar *php_retval;
gsize cp_len;
zend_bool free_result;
NOT_STATIC_METHOD();
if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")){
return;
}
list = gtk_about_dialog_get_artists(GTK_ABOUT_DIALOG(PHPG_GOBJECT(this_ptr)));
array_init(return_value);
while( i < sizeof( list ) ){ //I know sizeof() is wrong here//
cp_ret = phpg_from_utf8(php_retval, strlen(php_retval), &cp_len, &free_result TSRMLS_CC);
add_index_string(return_value, i, cp_ret, 0 ) ;
i++;
}
}
/****************************************************/
Sorry to be a pain
Regards,
Simon.