C++ help with char array to byte array conversion

I am a beginner c++ programmer hoping someone can guide me to the right method to use to do this most effectively. My LCD screen outputs byte array strings… by program generates certain mode output that I want to feed to the LCD to update the screen… char to unsigned char? Any help would be appreciated!

byte SPLASH[1][9] = {"Shutdown"};
char mode[9] = "Downtown";

How can I get “Downtown” to replace “Shutdown” in the SPLASH variable?

thanks,
Brian

strncpy((char*)&SPLASH[0], mode, sizeof(SPLASH[0]));
2 Likes

@ScruffR - perfect! works like a charm

note to self to study up on the ((char*) treatement and your use of strncpy… that’s what I could not figure out… I’ll read up on that strncpy function variables.

This (char*) is called a type cast which tells the compiler to treat the next variable as a char-pointer and not as a byte[][] since strncpy() expects a char* as first parameter.