diff --git a/cores/esp8266/IPAddress.cpp b/cores/esp8266/IPAddress.cpp index dea1d18a9..dff91d8af 100644 --- a/cores/esp8266/IPAddress.cpp +++ b/cores/esp8266/IPAddress.cpp @@ -64,3 +64,17 @@ size_t IPAddress::printTo(Print& p) const { return n; } +char *IPAddress::toCharArray() +{ + static char szRet[20]; + String str = String(_address.bytes[0]); + str += "."; + str += String(_address.bytes[1]); + str += "."; + str += String(_address.bytes[2]); + str += "."; + str += String(_address.bytes[3]); + str.toCharArray(szRet, 20); + return szRet; +} + diff --git a/cores/esp8266/IPAddress.h b/cores/esp8266/IPAddress.h index 73c6cbdf4..21e775ef5 100644 --- a/cores/esp8266/IPAddress.h +++ b/cores/esp8266/IPAddress.h @@ -70,6 +70,7 @@ class IPAddress: public Printable { IPAddress& operator=(uint32_t address); virtual size_t printTo(Print& p) const; + char * toCharArray(); friend class EthernetClass; friend class UDP;