eduperez wrote:I am afraid there is a bug (or two) in you code:
You have declared CURRENT_SSID_CHAR as a pointer, but you have not initialized it, or allocated any memory for the data you want to store there. Thus, your call to os_strncpy is writing data somewhere within your device's memory where you are not expected to write any data.
Now, remember that os_strncpy does not zero-terminate the destination string when it has to truncate the input. Thus, when the SSID name is longer than 15 characters, CURRENT_SSID_CHAR becomes an unterminated string, and the call to Serial.println will probably send some unwanted characters to the serial.
Hope this helps!
I'll have to try this after work, but calling malloc() with 16 bytes, 15 for the SSID and then one for the terminator, this should work?
EG:
char* CURRENT_SSID_CHAR;
CURRENT_SSID_CHAR = (char*) malloc(16);
I'll have to look into C char arrays more, I have never properly looked into them...
Thanks!