Re: Simple way to list keys & values of a GHashTable object?
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: "Frederick C. Lee" <frederick_lee apple com>
- Cc: gtk-list gnome org
- Subject: Re: Simple way to list keys & values of a GHashTable object?
- Date: Wed, 10 Nov 2010 23:54:16 +0100
On Wed, 2010-11-10 at 13:46 -0800, Frederick C. Lee wrote:
> Greetings:
> I'm a GTK neophyte working with Objective-C/C.
>
> I came across a GHashTable object that I want to decipher.
>
> I would like to do a printf() of the keys and/or values of this particular GHashTable object.
>
> This particular GHashTable is very small and I'm not interested in efficiency; just simplicity.
>
> In ObjC, one can merely do a [NSDictionary allKeys] & [NSDictionary allValues] and be done with it.
>
> What is the simplest way to do this?
>
you can use GHashTableIter:
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (hash_table, &iter);
while (g_hash_table_iter_next (&iter, &key, &value))
g_print ("key: %s, value: %s", (const char *) key, (const char *)
value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]