Skip to content

Commit 987b484

Browse files
committed
IPAddress.toString() Methode added
1 parent f68517e commit 987b484

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/arduino/IPAddress.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,10 @@ size_t IPAddress::printTo(Print& p) const
112112
return n;
113113
}
114114

115+
String IPAddress::toString() const
116+
{
117+
char szRet[16];
118+
sprintf(szRet,"%u.%u.%u.%u", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3]);
119+
return String(szRet);
120+
}
121+

src/arduino/IPAddress.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class IPAddress : public Printable {
6464
IPAddress& operator=(uint32_t address);
6565

6666
virtual size_t printTo(Print& p) const;
67+
String toString() const;
6768

6869
friend class EthernetClass;
6970
friend class UDP;

0 commit comments

Comments
 (0)