Relative Content

Tag Archive for cembeddedc-strings

How to exact match embedded C string containing the ‘%’ character?

In embedded C, I have a need to exact match a locally defined c-string with an incoming property string received from a cloud API. The incoming string ends with a percentage character, as in fooBar%. The locally defined string is from a string literal, as in #define FOOBAR_PROPERTY "FooBar%". This fails to match in the function call strncmp((CHAR*)property_name, FOOBAR_PROPERTY, property_name_len).