how to compare a string tyo uint8_t?
Posted: Wed Nov 30, 2016 2:18 am
Hello.
I using websockets for de NodeMCU in the next format:
There is a mesage coming in with case:
Now I want to test payload with a string by :
if ( payload == string)
This gives errors because I try to compare a string to uint8_t pointer.
How to convert the string to uint8_t or visa versa to be able to compare?
Thanks in advance
I using websockets for de NodeMCU in the next format:
Code: Select all
void webSocketEvent(WStype_t type, uint8_t * payload, size_t lenght)
There is a mesage coming in with case:
Code: Select all
case WStype_TEXT: {
USE_SERIAL.printf("[WSc] get text: %s\n", payload);
}
Now I want to test payload with a string by :
if ( payload == string)
This gives errors because I try to compare a string to uint8_t pointer.
How to convert the string to uint8_t or visa versa to be able to compare?
Thanks in advance