insert const char * inside char array

Hi,

I would like to parse this variable value below :

const char * msg = "1,2,3,4,5,6";

inside this array:

Array led [1,2,3,4,5,6] = CRGB::Black;

Can you please send me the code for that ?

Thank you very much!!!

I'm not sure exactly what you are requesting. Also, this forum is to help you with code, not write code for you. If you will make your best attempt we will help you.

This is not correct syntax. What are you trying to do?

Array led [1,2,3,4,5,6] = CRGB::Black;

i have a 8X8 Led matrix, which is 64 led.

In order to activate led number 1 et 2 for example with white color here's the syntaxe :

char led [1,2] = CRGB::RED;

i have a mobile app that send the led numbers, which i store as const char * variable in order to activate a certain leds.

My question is what is the right syntaxe to parse a const char * value seperated with commas, inside the led array variable :

Something like that :

const char * input ="1,2,3,4,5";

led [input] = CRGB::Black; // result led[1,2,3,4,5]

no_user:
i have a 8X8 Led matrix, which is 64 led.

In order to activate led number 1 et 2 for example with white color here's the syntaxe :

char led [1,2] = CRGB::RED;

No, that set led 2 to RED and does nothing with led 1. See Comma Operator.

no, it doses activate the both 1 and 2 led.
Now please i just want the right syntaxe to parse it inside the array like above

void parseMessage(const char *msg)
{
  unsigned number = 0;


  while (*msg != '\0')
  {
    if (isDigit(*msg))
    {
      number *= 10;
      number += (*msg - '0');
    }


    if (*(msg + 1) == ',' || *(msg + 1) == '\0')
    {
      led[number] = CRGB::Black;
      number = 0;
    }
    
    msg++;
  }
}