esp8266 change SSID

#include <ESP8266WiFi.h>
const char* ssid = "123123123";
const char* pass = "12345678";

//setting port
WiFiServer server(80);

void setup()
{
  Serial.begin(115200);  
  WiFi.begin(ssid, pass);
  Serial.println("Connecting");
  //wifi connect
  
  while (WiFi.status() != WL_CONNECTED)
  {
    Serial.print(".");
    delay(500);
  }
  //print out all i need data
  printout();
  server.begin();
  Serial.println("Server Started");
  Serial.println(WiFi.status());
  
}


//*********************************************
void loop()
{
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
  client.println("connected");
  Serial.println("connected to sever");
  while (client.connected())
  {
    if (client.available())
    {
      String x = client.readStringUntil('\r');
      x.trim();
      Serial.println(x);
      client.println("get data");
      client.flush();
      if (x == "OFF" || x == "off")
      {
        client.println("STOP");
        Serial.println("STOP");
        client.stop();
      }
    }
    if (Serial.available())
    {      
      Serial.flush();
      String x = Serial.readStringUntil('\r');
      x.trim();      
      if (x == "push down")
      {
        client.println("push down");
        client.flush();       
      }
      if (x == "push up")
      {
        client.println("push up");       
        client.flush();
      }
      if (x == "push2 down")
      {
        client.println("push2 down");
        client.flush();
      }
     if (x == "push2 up")
      {
        client.println("push2 up");
        client.flush();
      }
    }
  }
}



void printout() {
  Serial.println("");
  Serial.print("connected to SSID:  ");
  Serial.println(WiFi.SSID());
  Serial.print("server status:  ");
  Serial.println(server.status());
  IPAddress ip = WiFi.localIP();
  Serial.print("localIP:  ");
  Serial.println(ip);
}

now i hope i can change the wifi "ssid" and "pass" without open arduino ide , but i don't know how to do it
hope u guys can help me plz .
thanks all
i'm using arduino nano with esp8266 to be a server

now i hope i can change the wifi "ssid" and "pass" without open arduino ide , but i don't know how to do it

Can you change the value of a const "variable"? No.

You'd need to lose the const keyword.

Then, in setup(), you'd have to read serial data, until the ssid value arrived, storing the data in ssid.
Then, you'd have to read serial data, until the pass value arrived, storing the data in pass.

Then, you'd call begin() with the recently arrived values.

You would probably want a timeout period, so it would not wait forever before connecting to the default SSID.

sorry about my bad express

I mean i hope when this device can not connect to the network can set himself as a AP mode and then through the web may be a way to change my WIFI SSID and PASS and then restart it and it will be able to successfully connect to the specified WIFI and that i can control it

because I want it can be used not only my home but somewhere else

sorry my english is not good i'm doing this for a few days but i can't figure out how to reslove it