Re: EEPROM on esp8266 cause some problems!!!
Posted: Sun Oct 01, 2017 9:49 am
martinayotte wrote:mahdinga wrote:hello guys!!!
in addition, i am saving a struct including some (String)s and (int)s(3 Strings and 12 int) and i use EEPROM.put(1,MyStruct); for saving data and EEPROM.get(1,MyStruct); for retrieving data.
Be carefull how you manage your String in the structure, because they are pointers to String object not to character array expected, so when restored, those pointers are pointing to no where, therefore you get such crashes...
Your structures should contains character arrays with predefined length, and then you should copy the String into it using "memcpy(st.str, str.c_str(), str.length());"