Re: g_hash_table_find()
- From: Vlad GALU <dudu diaspar rdsnet ro>
- To: gtk-app-devel-list gnome org
- Subject: Re: g_hash_table_find()
- Date: Sun, 20 Jun 2004 11:56:02 +0300
On Sun, 20 Jun 2004 18:48:55 +1000
Russell Shaw <rjshaw netspace net au> wrote:
Hi,
What does g_hash_table_find() return?
It returns a gpointer, but the api is unclear
on what it is.
Returns: The value of the first key/value pair is returned, for which func
evaluates to TRUE. If no pair with the requested property is found,
NULL is returned.
How can it point to a key *and* its value? I'm trying to get the key
value with little success (it's stored as a guint).
You might want to try g_hash_table_lookup(). You give a key as an argument, and it returns the
associated value. If there's no value identified by the supplied key, it returns NULL.
I have written a small software that makes extensive use of the GHashTable structure:
http://night.rdslink.ro/dudu/glflow/glFlow-0.0.1.tar.gz
I'm using g_direct_hash().
static gboolean
findfunc(gpointer key, gpointer value, gpointer user_data)
{
return !strcmp(value,user_data); // value is a gchar*
}
gchar *s="groundzero";
gpointer key=g_hash_table_find(hashtab,findfunc,s);
guint n=GPOINTER_TO_UINT(key);
fprintf(stream,"%u",n);
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
----
If it's there, and you can see it, it's real.
If it's not there, and you can see it, it's virtual.
If it's there, and you can't see it, it's transparent.
If it's not there, and you can't see it, you erased it.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]