The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 04-30-2008
jim mcnamara jim mcnamara is offline
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,419
Are you trying to eliminate duplicates, sort or what?
Using search.h and maybe lsearch() or hsearch() will do what you need. If the data is redundant, hsearch() is not the best choice.

I personally deal with stuff like this by creating an array of pointers, then sorting the array using qsort, which allows one to access an element with bsearch() using a key. Sorting an array of structs is too expensive. But it is not clear what you need.
Reply With Quote