Changing the port name on OTA with esp8266. what is happening with c_str?

I'm using a program I found and I notice it allows you to change the port name you see on the IDE. I thought this would be handy but I have idea what is happening in the line with auto connect in it.

Can you hazard a guess?

#define HOSTNAME "Garage-"

//then in setup:
  String hostname(HOSTNAME);
  hostname += String(ESP.getChipId(), HEX);
  if (!wifiManager.autoConnect((const char *)hostname.c_str())) {  // what is this doing?
    delay(3000);
    WiFi.disconnect(true);
    ESP.reset();
    delay(5000);
  }

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.