Glib questions.



I don't know if this an appropriate forum for posting Glib questions
or not.  I have a problem in which I was going to use a hash table to
solve, but am know having doubts, or wondering if there is a better
approach.  Basically I need to store a string followed by an integer,
(although for now I'm just storing the int as a string and converting
as necessary).  Each time a string comes along I basically increment
the integer.  Eventually I dump the list sorted on the integer. So
I've worked through doing the look up in the hash table and have that
working appropriately, but it looks like the only way to sort is to
dump out of the hash, and either sort myself or say strcat(value and
the key) into a list and sort that list....  Which brings me to why
not just use a list in the first place, except of course then I can't
only search on the first string...  The data_relation seems to also
get me almost there, but then not allow me to sort.   Intuition tells
me to just manipulate the GHash directly, but the manual suggests that
I shouldn't.   A couple of functions, one that returns a list of
values sorted by key and another that returns a list of keys sorted by
values seem like they would be useful... Any way it seems like a
somewhat common piece of code and I'm lazy as a sack of potatoes so if
someone know a better way please let me know.... Using Glib...  

Again my apologies if this is the wrong list... please feel free to
slap me and send me to the right one. 


Thanks in advance


Mojo
-- 

_______________________________________________________________________________

You are not a fool just because you have done something foolish --
only if the folly of it escapes you.



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