Nп/п : 27 из 100
 От   : Kenny McCormack                     2:5075/128        21 авг 23 10:50:09
 К    : wij                                                   21 авг 23 13:52:02
 Тема : Re: Question about hsearch(3) ENTER method
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 1@news.xmission.com>
6c067aff
@REPLY:
<40b905c7-54ae-4e9f-bd6c-990f8e0e804an@googlegroups.com> 755f22c9
@REPLYADDR Kenny McCormack
<gazelle@shell.xmission.com>
@REPLYTO 2:5075/128 Kenny McCormack
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID:
1@news.xmission.com>
@RFC-References:
<40b905c7-54ae-4e9f-bd6c-990f8e0e804an@googlegroups.com>
@TZUTC: -0000
@TID: FIDOGATE-5.12-ge4e8b94
In article <40b905c7-54ae-4e9f-bd6c-990f8e0e804an@googlegroups.com>,
wij  <wyniijj5@gmail.com> wrote:
>manpage of hsearch(3) says:
>...
>The argument action determines what hsearch() does after an  unsuccess
>       ful  search.   This  argument must either have the value ENTER, meaning
>       insert a copy of item (and return a pointer to the new hash table entry
>       as the function result), or the value FIND, meaning that NULL should be
>       returned.  (If action is FIND, then data is ignored.)
>...
>
>When  I  want  to  insert  an  item into  the  hash  table,  I  invokes
>hsearch(item,ENTER). But I only want to  insert the item when it is not
>in the hash table. How can I do (Only invokes hsearch once. The manpage
>seems not mentioning the condition I am looking for)?

I had never heard of these functions before reading your post.  They look
interesting, so thanks for that.

Re: your question.  It looks to me that it will "just work".  I.e., if the
entry is already there, FIND & ENTER do the same thing.

P.S.  The main thing I think is missing from these functions is a "delete"
capability.  Oh, and an "edit" capability.

-- 
Just like Donald Trump today, Jesus Christ had a Messiah complex.

And, in fact, the similarities between the two figures are quite striking.
For example, both have a ragtag band of followers, whose faith cannot be shaken.
--- trn 4.0-test77 (Sep 1, 2010)
 * Origin: The official candy of the new Millennium (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх