How to convert String to char*

Hello.
My code is:

uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen=VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen))
{
int i;
for (o = 0; o < buflen; o++)
{
}

if (o == buflen) {

hashMes = hashMes + String(buf[o]);

hashMes.toCharArray(hashMes, o);

but i keep getting an error message: "no known conversion for argument 1 from ‘String’ to ‘char*’
no matching function for call to ‘String::toCharArray(String&, int&)’
"
Thanks for help.

PS: I’m still a starter so don’t be angre with me if this post is stupid. :smiley:

Post you whole code within code tags. Don’t know how? Read the How to use this forum post.

Stop using Strings in the first place. Then you won't need to convert a String to a string.

Sending a String instance the message '.c_str()' will retrieve a pointer to its immutable backing c style string.

lloyddean:
Sending a String instance the message ‘.c_str()’ will retrieve a pointer to its immutable backing c style string.

Sounds like Objective C-speak.

Or Swift, or …

In a non-c++ zone at the moment!

PaulS:
Stop using Strings in the first place. Then you won't need to convert a String to a string.

How should i do it instead?

I'm getting next to nothing from your code fragments.

Perhaps more code and a description of what you're doing would entice others to provide more useful suggestions?

I'm getting an message from an radio module and want to hash the message. You'll get the full code if i'm back at the pc.