1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Added function on WString class to export char ptr

This commit is contained in:
Mimmo La Fauci 2013-02-08 19:21:46 +01:00
parent 62e48dba91
commit a0c96bebdd
3 changed files with 7 additions and 5 deletions

View File

@ -53,11 +53,8 @@ size_t Print::print(const __FlashStringHelper *ifsh)
size_t Print::print(const String &s)
{
size_t n = 0;
for (uint16_t i = 0; i < s.length(); i++) {
n += write(s[i]);
}
return n;
write((const uint8_t*)s.c_str(), s.length());
return s.length();
}
size_t Print::print(const char str[])

View File

@ -642,4 +642,8 @@ long String::toInt(void) const
return 0;
}
char* String::c_str() const
{
return buffer;
}

View File

@ -169,6 +169,7 @@ public:
// parsing/conversion
long toInt(void) const;
char* c_str() const;
protected:
char *buffer; // the actual char array