Re: compare entry with list



Hi Pablo

I used memcmp() instead of strcmp() since strcmp() creates some
worries inside..gtk..

i think memcmp() is more efficient for usage in gtk compared to
strcmp()..anyways the result is the same with the code....

Thank you

Vinod


On Tue, 25 Jan 2005 09:34:45 -0800, Paolo Costabel
<paolo zebradevelopment com> wrote:
Vinod Joseph wrote:

Hello Members

Please guide me why this operation fails logically for some values at
some times....

Dosent give a consistent behavior...

Please help...

Callback_Function_on_userid_entry(GtkWidget *entry)
{

const gchar *entry_text;
 entry_text = gtk_entry_get_text (GTK_ENTRY (entry));

 g_print("\n Entry Text value = %s", entry_text);

 for ( i = 0; i <= articles->len - 1 ; i++ )
 {
       g_print("\n User ID Values = %s \n", g_array_index (articles,
User, i).userid);

        if((memcmp(entry_text, g_array_index (articles, User,
i).userid, strlen(entry_text)) < 0) || (memcmp(entry_text,
g_array_index (articles, User, i).userid, strlen(entry_text)) < 0))
        {
               if((memcmp(g_array_index (articles, User, i).userid,
entry_text, strlen(g_array_index (articles, User, i).userid)) != 0) ||
(memcmp(g_array_index (articles, User, i).userid, entry_text,
strlen(g_array_index (articles, User, i).userid)) != 0))
               {
                       g_print("\n 2nd list of ID Values = %s \n",
g_array_index (articles, User, i).userid);
                       create_userid_dialog(window);
               }
       }

g_free(entry_text);

}

Thank you

Vinod
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



Why are you using  memcmp instead of strcmp? Are you sure the case is
the same?




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