access variable...

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

 



Hi,

sorry for the silly question but how do I access the variables.... see my code below...

#include <stdlib.h>
#include <glib.h>

gboolean
tempo(gpointer data)
{
    gint j = 0;
    j = (gint)(data->i); // HOW TO ACCESS THE STRUCTURES VARIABLES???
    g_print("%d", j);
    return TRUE;
}


gint
main(gint argc, gchar *argv[])
{
    GMainLoop *loop;
    struct
    {
    gint i;
    } *udata;
    udata = g_malloc(sizeof(gint) + sizeof(gchar));
    udata->i = 1;
   
    g_print("Delay: %s. ", argv[1]);
    g_print("i: <%d>\n", udata->i);
    g_timeout_add(g_ascii_strtod(argv[1], NULL), (GSourceFunc)tempo, (gpointer)udata);
    loop =  g_main_loop_new(NULL, TRUE);
    g_main_loop_run(loop);
   
    return 0;
}


--
-- Yianni
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux