I seem to he having an issue with the strlen() call.
If I create a string say "char data[20]" and make that "this is a test\r\n" I get back a length of 16
Although that should return a len of 17 with 14 being characters and then one for the \r and one for the \n.
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
char tdr[20];
char data[20];
snprintf(tdr, 20, "this is a test\r\n");
Serial.println(tdr);
Serial.print("The length of the string is: ");
Serial.println(strlen(tdr));
delay(10000);
}
This is causing all kinds of issues in the sketch I am working on right now because the ESP8266 requires that you give it a string length before sending the string to the unit.
Am I doing this wrong? Is this a bug? How can I get around it?