Re: compare entry with list



Vinod Joseph wrote:

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

I think that the usage of memcmp() in your code is wrong.
You're doing something like:

   memcmp (x, y, strlen (x));

But if you want to know if two *strings* are *equal*, you should consider the trailing '\0', so the right way would be:

   memcmp (x, y, strlen (x) + 1);


*
Maulet



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