mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-07 16:23:38 +03:00
change toCharArray() to toString()
This commit is contained in:
parent
664d92fbd0
commit
b28e879af6
@ -64,17 +64,10 @@ size_t IPAddress::printTo(Print& p) const {
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *IPAddress::toCharArray()
|
String IPAddress::toString()
|
||||||
{
|
{
|
||||||
static char szRet[20];
|
char szRet[16];
|
||||||
String str = String(_address.bytes[0]);
|
sprintf(szRet,"%u.%u.%u.%u", _address.bytes[0], _address.bytes[1], _address.bytes[2], _address.bytes[3]);
|
||||||
str += ".";
|
return String(szRet);
|
||||||
str += String(_address.bytes[1]);
|
|
||||||
str += ".";
|
|
||||||
str += String(_address.bytes[2]);
|
|
||||||
str += ".";
|
|
||||||
str += String(_address.bytes[3]);
|
|
||||||
str.toCharArray(szRet, 20);
|
|
||||||
return szRet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define IPAddress_h
|
#define IPAddress_h
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <WString.h>
|
||||||
#include <Printable.h>
|
#include <Printable.h>
|
||||||
|
|
||||||
// A class to make it easier to handle and pass around IP addresses
|
// A class to make it easier to handle and pass around IP addresses
|
||||||
@ -70,7 +71,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();
|
String toString();
|
||||||
|
|
||||||
friend class EthernetClass;
|
friend class EthernetClass;
|
||||||
friend class UDP;
|
friend class UDP;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user