just wondering if this is possible,
I would like a string input equal to a char, when the input button is pressed.
so at the top i define WLAN_SSID
#define WLAN_SSID "abc"
I have also initialized the input which changes depending on the buttons pressed on the device.
String input = "abcdefg";
and somewhere below in the code I have :
char *ssid = WLAN_SSID;
I need *ssid to stay as char, but is there anyway to make it equal to the String 'input'?
thanks
You certainly can not assign
WLAN_SSIDto achar*because string literals are of typechar const[N](with a suitableN) which happily decay intochar const*s but refuse to be assigned tochar*s. If you really need to deal with achar*, you'll need to allocate sufficient space and copy the value into this memory. Of course, when changing it you'll also need to release the memory appropriately. For example