convert string to char

Hi guys ,
i have problem with esp32 , i receive ssid and password value through serial bluetooth as string value
and i successfully save the values in EEPROM but i have problem when i try to use values to connect to wifi , i think i have to convert values from string to char but i dont know how ...

this is the code i use and i attache screen shot to Err i faced on ide

#include "BluetoothSerial.h"
#include <WiFi.h>
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif


BluetoothSerial SerialBT;



#include "EEPROM.h"
int addr = 0;
int addr1 = 20;
#define EEPROM_SIZE 64
String ssid ;
 String password  ;




void setup() {
  Serial.begin(115200);
   ssid = EEPROM.read(addr) ;
    password = EEPROM.read(addr1) ;

  WiFi.begin(ssid, password);
  SerialBT.begin("JD0001"); 


    if (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.println("WIFI NOT CONNACTED..");
  }else(){
    Serial.print(">>>>>>>>>>>>>WIFI OK<<<<<<<<<<<")
  }
 if (!EEPROM.begin(EEPROM_SIZE))
  {
    Serial.println("failed to initialise EEPROM"); delay(1000000);
  }

   Serial.print("ssid :  ");
  Serial.println(ssid);
   Serial.print("password :  ");
  Serial.println(password);

}

void loop() {
 
 
  String x=SerialBT.readString();
     if(x=="a"){
       state1: 
       if(SerialBT.available()>0){
  ssid=SerialBT.readString();
  EEPROM.writeString(addr,  ssid);
  EEPROM.commit();
  Serial.print("ssid  is : ");
  Serial.println(EEPROM.readString(addr));
     }else{goto state1;}
               }
     
     
    if(x=="b"){
       state2: 
       if(SerialBT.available()>0){
  password=SerialBT.readString();
  EEPROM.writeString(addr1,  password);
  EEPROM.commit();
  Serial.print("password  is : ");
  Serial.println(EEPROM.readString(addr1));
     }else{goto state2;}
               }

               

}

Quite apart from any other problems

   ssid = EEPROM.read(addr)

Does this read the whole String or just one byte ?

String thestring="whatever";
char charpointer[thestring.length()+1];
thestring.toCharArray(charpointer, thestring.length()+1);

Converts a String to a char *

The String library has the toCharArray() function but that does assume that you have a String in the first place

UKHeliBob:
The String library has the toCharArray() function but that does assume that you have a String in the first place

well the plan was

String ssid ;
 String password  ;

Deva_Rishi:
well the plan was

String ssid ;

String password  ;

But what do you get when you do

   ssid = EEPROM.read(addr) ;
    password = EEPROM.read(addr1) ;

Have you tried printing ssid and password after reading from EEPROM ?

UKHeliBob:
Quite apart from any other problems

   ssid = EEPROM.read(addr)

Does this read the whole String or just one byte ?

So why do you ask a question when you want to make a statement ? Don't get me wrong, you are absolutely correct, and reading a String from the EEPROM does require reading up to a pre-defined separator. But that was not the question.

So why do you ask a question when you want to make a statement ?

In order to make the OP think rather than just spoon feeding them the answer