lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] How to manage non null-terminated strings


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

Many times in the application payloads you have a message with non null-terminated string, where the length of the string is in another variable (derived from the length of the packet).

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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]