tags:

views:

95

answers:

1

I'm trying to sort a GLib hash table by id that looks something like:

key - id
    {
    "Red",     2,
    "BLue",    4,
    "Yellow",  5,
    "Orange",  8
    } 

I'm just not sure how to approach this because GLib does not have a sort method. I was thinking to use qsort or GCompareFunc

Any ideas will be appreciate it!

+1  A: 

Hash tables aren't supposed to be sorted. You should get a GList* from the g_hash_table_get_keys (or values if that's what you're sorting) and sort that. Also, be careful about confusing glibc and GLib.

SB
Thanks for the info!
Mike