-2

I've got two const char [] PROGMEM variables that I need to concatenate into another const char [] PROGMEM. I'm totally new to C and couldn't understand how to use strncpy on a previous question.

const char data_one[] PROGMEM = {0x00,0x01,0x02};
const char data_combined[] PROGMEM = data_one + "{0x03,0x04,0x05}";
Sam Denty
  • 3,693
  • 3
  • 30
  • 43

1 Answers1

1

Using memcpy (or strcpy or similar) will not be possible since the destination is constant and read-only. You also cannot use something like you show in your sample code.

The only solution I can think of is also one I really don't recommend, since it will make the code somewhat obfuscated and hard to read and maintain, and that is using pre-processor macros.

Ed Heal
  • 59,252
  • 17
  • 87
  • 127
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621