Flattening a multi-dimensional char array to an char* array

Hello,
I have been trying to read a file from an SD card into an array. I now have this array, but it is not in the format I would like. I want it ion a char* string array. This is what I have so far:

char IRCodes[4][5];
// I want to replace the numbers with the IRcodes
// to end up with:  char* irCommand[] = {"C0E8","C091","C061","C001"}; 
char* irCommand[] = {"0000","0001","0002","0003"}; 

void setup() {
  IRCodes[0][0] = 'C';  // this array is what I get after I have
  IRCodes[0][1] = '0';  // read the file from the SD card.
  IRCodes[0][2] = 'E';
  IRCodes[0][3] = '8';
  IRCodes[0][4] = '\0';
  IRCodes[1][0] = 'C';
  IRCodes[1][1] = '0';
  IRCodes[1][2] = '9';
  IRCodes[1][3] = '1';
  IRCodes[1][4] = '\0';
  IRCodes[2][0] = 'C';
  IRCodes[2][1] = '0';
  IRCodes[2][2] = '6';
  IRCodes[2][3] = '1';
  IRCodes[2][4] = '\0';
  IRCodes[3][0] = 'C';
  IRCodes[3][1] = '0';
  IRCodes[3][2] = '0';
  IRCodes[3][3] = '1';
  IRCodes[3][4] = '\0';


  Serial.begin(19200);

  char* strCmd;
  int cc = 0;
  for (int i=0; i < 4; i++) {
    Serial.print(i);
    Serial.print(". ");
    strCmd = "";
    for (int ii = 0; ii < 5; ii++) {
      Serial.print(IRCodes[i][ii]);
      strCmd += IRCodes[i][ii];      // does not work
    }

    Serial.print("\n");
    Serial.println(strCmd);
    
    irCommand[i] = strCmd; 
  }
  
  Serial.println("-----------");
  for (int i=0; i < 4; i++) {
    Serial.print(i);
    Serial.print(". ");
    Serial.println(irCommand[i]);   
  }
}
void loop()
{
  // nothing happens after setup
}

as you can see, the variable strCmd is not picking up the element from IRcodes.

Can you help?
Thanks
Karl.

(1) You cant just add char arrays, there is no such operator defined:

      strCmd += IRCodes[i][ii];      // does not work

(2) You have declared strCmd as a pointer. This means that the compiler has allocated only two bytes of memory to store a pointer to a char. This is not an array, it is just a pointer, so the compiler doesn't know to allocate a block of memory for an array

 char* strCmd;
  int cc = 0;
  for (int i=0; i < 4; i++) {
    Serial.print(i);
    Serial.print(". ");
    strCmd = "";

(3)In the last part of that code snippet you try to assign a string to your pointer, this cannot be done in C. And again in this bit:

    irCommand[i] = strCmd;

Try making some adjustments, such as:

  char irCommand[4][5] = {"0000","0001","0002","0003"}; 

...

  int cc = 0;
  for (int i=0; i < 4; i++) {
    Serial.print(i);
    Serial.print(". ");
    strCmd[0] = '\0';
    strcpy(irCommand[i], IRCodes[i]); //copy from ircodes into ircommand

    Serial.println();
    Serial.println(strCmd);
  }

Hello Tom
Thanks for the reply, I now have my program working as I want to.

It was the change to char irCommand[4][5] and using strcpy(irCommand_, IRCodes*); that made all the difference.*_
Karl.