I'm not exactly sure how to accomplish this, I have searched and tried many different things but I just cant get it to work? strcpy(host, DATA); is what gives me the error.
char host[60] = "www.yahoo.com"; void loop() { String content = ""; char character; while (Serial.available()) { character = Serial.read(); content.concat(character); } if (content != "") { String CMD = getValue(content, '|', 0); String DATA = getValue(content, '|', 1); if (CMD == "SSID") { Serial.println("Your CMD is:" + CMD + " And your DATA is:" + DATA); } else if (CMD == "PASS") { Serial.println("Your CMD is:" + CMD + " And your DATA is:" + DATA); } else if (CMD == "HOST") { Serial.println("Your CMD is:" + CMD + " And your DATA is:" + DATA); strcpy(host, DATA); } } delay(100); }
String? It's certainly not achar*, which is whatstrcpyexpects. You need to convertStringto aconst char*, possibly through its member function. For example,std::stringhas ac_str()member function that does that.DATAisString, which is not the same aschar *orconst char*, and also there is no implicit conversion fromStringtochar*orconst char*.