Problem with linked lists and CLists



Hello everyone :)
I`m jus started writting in GTK+ 1.2 and I stuck in two points:
first I was trying tu put something from two dimensional array to CList but
I get again and again error but not during compilation but during program
run.
I know that the prototype of this function is like this:
    gint gtk_clist_append( GtkCList *clist, gchar    *text[] );
and as the second argument is given one dimensional array
but my piece of code is from tutorial and it shoul work or maybe there is
a mistake in gtk 1.2 tutorial ?

void button_add_clicked( gpointer data )
{
    int indx;
   gchar *drink[4][2] = { { "Milk",    "3 Oz" },
                           { "Water",   "6 l" },
                           { "Carrots", "2" },
                           { "Snakes",  "55" } };
    for ( indx=0 ; indx < 4 ; indx++ )
        gtk_clist_append( (GtkCList *) data, drink[indx]);
    return;
}

My second question is about double linked list in gtk. I created something
like this:


char numerr[]={"123"};
struct komp
{
    char *numer;
    char *ip;
    char *stan;
};
struct komp *elementy;
elementy=malloc(sizeof(struct komp));
strcpy(elementy->numer,numerr);
list_ko=g_list_append(list_ko,(gpointer)elementy);
printf("%s\n",(char*)list_ko->elementy->numer);

and maybe stupid question I don`t knw how to get tu the "numer" element of
this
list - list_ko->elementy->numer is wright ? or maybe I made some stupid
mistake ?
Or maybe this list is still not created because I made something wrong ?
Best regards

Simon





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