Code no work on esp

Saripudin
Posts: 1
Joined: Tue Mar 30, 2021 1:35 am

Code no work on esp

Postby Saripudin » Tue Mar 30, 2021 1:45 am

Sorry, maybe someone has a solution, I have a problem with converting strings to char aray

void stringTochar (String text)
{
char * tx = text.c_str ();
}
If compiled on board uno / nano / promini it can work, but if on board esp8266 / esp32 an error appears. What's the difference between c ++ Arduino and esp. Thank you

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Code no work on esp

Postby ESP_Sprite » Tue Mar 30, 2021 4:36 am

It would help if you post the error... for now, I think c_str returns a const char *, so the variable you push it in should have the same type.

Who is online

Users browsing this forum: No registered users and 68 guests