RE: Simple procedure question



Hi, 

I am not sure, but I think you have to initialize list to NULL such as:
Here is an example:

#include <glib.h>

int main()
{
        GList* list = NULL;

        list = g_list_append( list,"Hello" );
        list = g_list_append( list,"World" );

        while( list != NULL )
        {
          gchar* data = (gchar*)list->data;
          g_print("%s\n",data);

          list = g_list_next(list);
        }
}  

if you try that without initializing to NULL you get segment fault.
If it's not what you where asking about then sorry.

Ivo





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