Skip to main content
added 5 characters in body
Source Link

That's one of the peculiarities of the C language: the == operator compares the string addresses, not their content. It makes sense when you think of them as pointers, but it can be confusing for beginners.

To fix this, you can use strcmp() like so:

if (strcmp(status,"opened") == 0)

Alternatively, you can change the type of status to JsonVariant, like so:

JsonVariant status = doc["status"]

It works with JsonVariant because I overloaded the == operator to support string comparison.

That's one of the peculiarities of the C language: the == operator compares the string addresses, not their content. It makes sense when you think of them as pointers, but it can be confusing for beginners.

To fix this, you can use strcmp() like so:

if (strcmp(status,"opened"))

Alternatively, you can change the type of status to JsonVariant, like so:

JsonVariant status = doc["status"]

It works with JsonVariant because I overloaded the == operator to support string comparison.

That's one of the peculiarities of the C language: the == operator compares the string addresses, not their content. It makes sense when you think of them as pointers, but it can be confusing for beginners.

To fix this, you can use strcmp() like so:

if (strcmp(status,"opened") == 0)

Alternatively, you can change the type of status to JsonVariant, like so:

JsonVariant status = doc["status"]

It works with JsonVariant because I overloaded the == operator to support string comparison.

Source Link

That's one of the peculiarities of the C language: the == operator compares the string addresses, not their content. It makes sense when you think of them as pointers, but it can be confusing for beginners.

To fix this, you can use strcmp() like so:

if (strcmp(status,"opened"))

Alternatively, you can change the type of status to JsonVariant, like so:

JsonVariant status = doc["status"]

It works with JsonVariant because I overloaded the == operator to support string comparison.