mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-07 16:23:38 +03:00
add toCharArray() to IPAddress class
This commit is contained in:
parent
568c48b065
commit
664d92fbd0
@ -64,3 +64,17 @@ size_t IPAddress::printTo(Print& p) const {
|
|||||||
return n;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ class IPAddress: public Printable {
|
|||||||
IPAddress& operator=(uint32_t address);
|
IPAddress& operator=(uint32_t address);
|
||||||
|
|
||||||
virtual size_t printTo(Print& p) const;
|
virtual size_t printTo(Print& p) const;
|
||||||
|
char * toCharArray();
|
||||||
|
|
||||||
friend class EthernetClass;
|
friend class EthernetClass;
|
||||||
friend class UDP;
|
friend class UDP;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user