invalid conversion from 'const byte*' to 'uint8_t*'

I get the following warning: invalid conversion from 'const byte*' to 'uint8_t*'.I cannot seem to cast the output and get out of this warning. While I realize this is a warning and not an error. Problems like this have the habit of compiling and working Incorrectly. The output tends to be some strange number.

Please look: const_cast conversion - cppreference.com

I get the following warning

Warning: Invalid conversion from 'const byte*' to 'uint8_t*'

I cannot cast my way out of it. I realize it is merely a warning but while it compiles it might produce wrong results. Any help and pointers in the right direction are appreciated.

I have to convert the output of a function. How do I go about doing that? reinterpret_cast?

udayanmallik:
I get the following warning

You need to post the program that gives rise to the warning and tell us what Arduino board you are using.

...R

Duplicate topics moved and merged

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky “How to use this forum - please read.” post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

zwieblum:
Please look: const_cast conversion - cppreference.com

Simply suggesting the use of const_cast without any context or warnings is just wrong.

There are very few valid reasons to use cast away const, and most of the time it hints at a much deeper problem with the design of the code in question.

Using const_cast incorrectly (i.e. to cast away the const qualifier from a reference to a const object and then writing to it) is undefined behavior and will break your code.

AFAIK, the only scenario where it's okay to use const_cast is when you're dealing with external libraries that completely lack const-correctness.
Even in that case I would argue that opening an issue with the developer of that library would be more appropriate than adding const_cast to your code. (Or re-evaluate the choice of library.)

It's impossible to tell without more details from OP, but simply adding a const_cast will probably not solve the underlying problem.

Pieter