Part of a progmem char array to a string.

Hello,

i have arrays of char in progmem and i need a function to read out a part of that array into a string.
Cpp is not mit “native” language so i have problems with it…

I have writen some code but i get the error “invalid conversion from ‘char’ to ‘const char*’”.

const char* const menu[] PROGMEM = {"Text 1","Text 2","Text 3","Text 4"};
// and other arrays

String output;

String readp(char text)
{ 
  char c;
  int k;
  int len = strlen_P((char*)text);
  for (k = 0; k < len; k++)
  {
    strcat_P(c, pgm_read_byte_near(text + k));
  }  
return c;
}


void Setup()
{
  output = readp(menu[2]);
}

Could someone help me what i have to change to get it to work?

with best regards
M.age.P

strcat_P(c

c is a char.
You can't concatenate two chars.

Please - Dump the String class.

Also, setup() is not spelled Setup()

The program is missing the loop() and setup() functions and thus is incomplete. I will not help with the original question.

The complete error message should be posted in code tags.

Setup() and setup() are not the same function.

The readp(...) function is declared to return String but then returns a char.

The readp(...) function takes a char parameter but is then passed a const char * * based in PROGMEM.

The usual advice in Arduino land is to avoid the String class.