|
From: | Giuseppe Modugno |
Subject: | [lwip-users] How to manage non null-terminated strings |
Date: | Thu, 30 May 2019 10:35:53 +0200 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
I think of MQTT messages that have strings. The callback parameters are the pointer to the first char of string and the length of string.
Many times I need to compare the string against a fixed reference string. However I can't use strncmp(), because it would success if the string is shorter than the reference string.
I could copy the string in another array, but I think there's a better method.
[Prev in Thread] | Current Thread | [Next in Thread] |