[tip : spent some time on the tutorials about usiong arrays]
It is difficult to write character arrays of unequal length to eeprom. See code below (not tested). If you make a reservation in the eeprom for each string e.g. you use 12 bytes for each name it is far easier to extract the names from eeprom as you can calculate the start address.
(code not tested)
#include <EEPROM.h>
void setup()
{
Serial.begin(9600);
int addr = put_in_eeprom(0, "maka");
addr = put_in_eeprom(addr, "cukier");
addr = put_in_eeprom(addr, "mleko");
// etc
char buf[24]; // big enough I hope
addr = get_from_eeprom(0, buf);
Serial.println(buf);
addr = get_from_eeprom(addr, buf);
Serial.println(buf);
}
void loop()
{
}
void put_in_eeprom(int addr, char *p)
{
int i = 0;
while (p[i] != '\0');
{
EEPROM.write(addr+i, p[i]);
delay(5);
i++;
}
EEPROM.write(addr+i, p[i]);
delay(5);
return addr + i + 1; // next free place
}
int get_from_eeprom(int addr, char *p)
{
int i = 0;
char c = EEPROM.read(addr);
while (c != '\0');
{
p[i++] = c;
c = EEPROM.read(addr);
}
p[i] = '\0';
return addr + i + 1;
}
// there might be an off by one error in this code
