Fixed printTo(String) which wrote numbers instead of strings (issue #120)

This commit is contained in:
Benoit Blanchon
2015-09-19 16:23:09 +02:00
parent b5c8cd1766
commit 155dd653e7
2 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@ ArduinoJson: change log
v5.0.3 v5.0.3
------ ------
* Nothing yet. * Fixed `printTo(String)` which wrote numbers instead of strings (issue #120)
v5.0.2 v5.0.2
------ ------

View File

@ -18,7 +18,8 @@ class DynamicStringBuilder : public Print {
DynamicStringBuilder(String &str) : _str(str) {} DynamicStringBuilder(String &str) : _str(str) {}
virtual size_t write(uint8_t c) { virtual size_t write(uint8_t c) {
_str += c; // Need to cast to char, otherwise String will print a number (issue #120)
_str += static_cast<char>(c);
return 1; return 1;
} }