How to put data from eeprom into a char variable

Hi Everyone,

I have this sketch which writes a char to EEPROM,

#include <EEPROM.h>

int address = 0;

void setup()
{
  Serial.begin(9600);
  
  char data[] = "Hey there this is a test";//string that needs to be on eeprom 
  for(int i = 0; i < strlen(data); i++)  
    {
    EEPROM.write(address, data[i]); //write string to 
    address = address + 1;// move to next eeprom address
    }
}

void loop()
{

}

But now I want to read the char from the eeprom and I cant seem to come right, I can get it to read me the characters on a new line every time but what I really need is for the characters to be written to a single char variable (obviously specifying the address from start to finish in the eeprom)

anyone out there got any suggestions for me?

Read a byte, put it in a char array.
Read the next byte, put it in the next position in the char array
Keep doing this until the whole string has been read
Put a zero in the last position in the char array.
Now you have a string.

char data = EEPROM(memorylocation)

I have this sketch which writes a char to EEPROM,

No, it doesn't. It writes an ARRAY OF CHARS to EEPROM. You (and countless others) will have a MUCH easier time understanding how to get the data back when you learn to distinguish between a char and an array of chars.

Writing strings to EEPROM the way you are doing it is wrong. The length of the string is NOT an inherent attribute of the data that you have stored. You MUST store the length, too. It makes is SO much easier to store that length FIRST.