Hello,
A cant figure it out how to use char* for SSID name.
Example:
String SN = “20210000”;
char* esp_ssid = “myNetwork”;
So, ESP will create Access point with name myNetwork. I want my SSID name to be myNetwork-20210000.
I tried:
char* esp_ssid = “myNetwork” + SN; or
char* esp_ssid = (“myNetwork-” + SN).c_str();
None works. Can you help me please.
Best regards,
Robert
Yes, I have the same problem. How does one convert String to char *?
c_str() does not seem to be in the library.
The following compiles, and surely works:
String SN = “20210000”; const char *esp_ssid = (“myNetwork-” + SN).c_str();
Note the “const” for the char * pointer.
But you are better off not using String, and esp_ssid does not have to be const:
char esp_ssid[32]; char *SN = "20220000"; strcopy(strcopy(esp_ssid, “myNetwork-”), SN);
where
char *strcopy(char *p, const char *s) { while (*s != '\0') *p++ = *s++; *p = '\0'; return p; }