user48808: I want to convert const char array in PROGMEM to String. How do I do this?
const char charArray[] PROGMEM = "Some text";


user37622: you can use a cast to __FlashStringHelper to invoke the right constructor of the String class. It is the constructor which copies the char array from PROGMEM. __FlashStringHelper is intended as return type for the F() macro.
const char charArray[] PROGMEM = "Some text";

void setup() {

  Serial.begin(115200);

  String s((const __FlashStringHelper*) charArray);

  Serial.println(s);
}

void loop() {
}


48808: <p>I want to convert const char array in PROGMEM to String. How do I do this?</p>

<pre><code>const char charArray[] PROGMEM = "Some text";
</code></pre>
 37622: <p>you can use a cast to <code>__FlashStringHelper</code> to invoke the right constructor of the String class. It is the constructor which copies the char array from PROGMEM. <code>__FlashStringHelper</code> is intended as return type for the F() macro.</p>

<pre><code>const char charArray[] PROGMEM = "Some text";

void setup() {

  Serial.begin(115200);

  String s((const __FlashStringHelper*) charArray);

  Serial.println(s);
}

void loop() {
}
</code></pre>
