Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String to const char* in Arduino?

I have a variable tweet that is a string and it has a character at the very beginning that I want to clip off.

So what I want to do is use strstr() to remove it. Here's my code:

tweet = strstr(tweet, "]");

However, I get this error:

cannot convert 'String' to 'const char*' for argument '1' to 
'char' strstr(const char*, const char*)

So my thought would be to convert tweet into a char. How would I go about doing so?

like image 829
iosfreak Avatar asked Dec 20 '11 16:12

iosfreak


1 Answers

string has a c_str() member function that returns const char *.

like image 158
Ernest Friedman-Hill Avatar answered Oct 15 '22 08:10

Ernest Friedman-Hill