I have strings that may contain character 0. They are stored in a structure like this:
typedef struct somestruct_s {
const unsigned char *string;
size_t length;
};
If I wish to compare 2 of these together I can use memcmp as such:
int match = (a->length == b->length) ? !memcmp (a->string, b->string, a->length) : 0;
But if I wish to compare 2 of these together without regard to case, my first instinct is to use strncasecmp/_strnicmp -- however, that function stops on null characters.
Is there a common C function already around that can do this. I don't mind writing my own, but before I do I want to make sure there isn't a standard function that I am unaware of.