1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-06 05:21:22 +03:00

add toCharArray() to IPAddress class

This commit is contained in:
Martin Ayotte 2015-08-20 23:43:01 -04:00
parent 568c48b065
commit 664d92fbd0
2 changed files with 15 additions and 0 deletions

View File

@ -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;
}

View File

@ -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;