Re: how to append more than 1 data element in g_list_append()



alprach ss wrote:
> 
>   hi...
>   how to add more than one data element in a g_list_append(...);
> 
>   i m working on a project in which i have more than 3 data elements
>   and i want to have them in a single linked list .how can
>   i add all the 3 data elements into linked list using g_list_append()
>   function;;
> 

Call it three times.

Seriously, I don't understand what you're trying to do.  If you have
three list elements, linked together (GList *pShortTmpList), and you
want to stick all three on the back of another list (CList *pMainList),
you can use pMainList = g_list_concat(pMainList,pShortTmpList).  Note
that the elements are now on the main list, IIReadDocsC you should set
or treat pShortTmpList = NULL.

This is in the documentation:
developer.gnome.org/doc/API/glib/glib-doubly-linked-lists.html#G-LIST-CONCAT

If you have just three pointers to data, call it three times.

Are you looking for:
GList *g_list_multi_append(GList *pTheList, 
                           gint iNumDataPointers, 
                           gpointer *pDataPointerArray)
{
	/* Code is left as an exercise */
}

Eric M. Monsler




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]