Re: Simple way to list keys & values of a GHashTable object?



Hi.

For simple printout, you may be interested in g_hash_table_foreach().
Something like this should dump key-value pairs to console (I assumed
here that both key and value are strings):

===
static void
dump_pair (const char *key,
           const char *value)
{
  g_print ("Key: %s Value: %s\n", key, value);
}

...

g_hash_table_foreach (table, (GHFunc)dump_pair, NULL);
===

Cheers,
Tadej

-- 
Tadej Borovšak
tadeboro.blogspot.com
tadeboro gmail com
tadej borovsak gmail com


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