Open mugginsjm opened 4 years ago
iam on this topic as i want to do the exact same thing ill post something if i made it work
Hope this helps
std::string one = "Hello, ";
std::string two = "World";
std::string three = one + two;
unsigned char* uc = (unsigned char*)three.c_str();
no, unfortunately not....
You cannot 'strcat' to your TxtDemo unsigned char array as it has only been defined with enough space for your hard coded characters. So even if you did not have the unsigned/signed errors it would have overwritten memory. You would have to add a suitable dimension in the '[]' to allow for the extra characters.
The next problem is that TxtDemo in the 'strcat' call is not a pointer, you would have to use &TxtDemo[4] and you would also have to cast it to a 'char *'.
unsigned char TxtDemo[256] = { EFFECT_HSV "\x00\xff\xff" }; // 4 chars + null char String txt="my text"; strcat((char *)&TxtDemo[4], txt.c_str()); ScrollingMsg.SetText(&TxtDemo[0], 4 + txt.length());
I am trying to dynamically update a 64x8 display using an ethernet socket connection which provides a string output. I am in a total "meltdown" in relation to unsigned char.... etc This code throws up error: invalid conversion from 'unsigned char' to 'char'
unsigned char TxtDemo[] = { EFFECT_HSV "\x00\xff\xff" }; String txt="my text"; strcat( TxtDemo, txt.c_str() );
ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);