From 4bbd4f7448907ed0133ef737fc694751f9f97ea3 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sat, 28 Aug 2010 10:23:54 +0000 Subject: Changing String::toCharArray() and getBytes() to accept a buffer, rather than return one. That way they don't expose the internal representation of the String class, allowing future optimization. Thanks to Paul Stoffregen. --- cores/arduino/Print.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cores/arduino/Print.cpp') diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp index 6fe162d..4ee556d 100755 --- a/cores/arduino/Print.cpp +++ b/cores/arduino/Print.cpp @@ -45,7 +45,9 @@ void Print::write(const uint8_t *buffer, size_t size) void Print::print(const String &s) { - print(s.toCharArray()); + for (int i = 0; i < s.length(); i++) { + write(s[i]); + } } void Print::print(const char str[]) -- cgit v1.2.3-18-g5258