NODEMCU V0.9 EEPROM String problem

Hi,

Today I wrote a simple program in arduino to storage String into the EEPROM. And when I try to receive the String from the EEPROM, the first letter is missing. Does someone know why?

Code:

#include <EEPROM.h>

String contentE= "Test";

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.print(" Memory: ");
  EEPROM.begin(512);
  EEPROM.put(0, contentE);
  EEPROM.commit();
  contentE = "";
  EEPROM.get(0, contentE);
  EEPROM.end();
  Serial.println(contentE);
}

void loop() {
}

Result:

Memory: est

Sorry, now I know, I can’t store Strings in EEPROM.

Thanks for taking the time to post an update with your findings Jozefteo!

// writing

String name = "arduino forum";

EEPROM.write(1,name.length());


for ( byte x = 0; x < name.length(); x++ ) {

EEPROM.write(x+2, name.charAt(x) );

}

EEPROM.commit();


// reading back


String name2 = "";

byte m = EEPROM.read(1);

for ( byte x = 0; x < m; x++ ) {

char c = EEPROM.read(x+2);
name2 += c;

}


Serial.println(name2);