Skip to content

Commit 2503868

Browse files
Add Print::write(const char *, size_t)
The new function just calls Print::write(const uint8_t *, size_t), but this allows writing out a buffer of chars (without having to learn about casts).
1 parent 660c7d8 commit 2503868

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

hardware/arduino/avr/cores/arduino/Print.h

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class Print
5151
return write((const uint8_t *)str, strlen(str));
5252
}
5353
virtual size_t write(const uint8_t *buffer, size_t size);
54+
size_t write(const char *buffer, size_t size) {
55+
return write((const uint8_t *)buffer, size);
56+
}
5457

5558
size_t print(const __FlashStringHelper *);
5659
size_t print(const String &);

hardware/arduino/sam/cores/arduino/Print.h

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class Print
5151
return write((const uint8_t *)str, strlen(str));
5252
}
5353
virtual size_t write(const uint8_t *buffer, size_t size);
54+
size_t write(const char *buffer, size_t size) {
55+
return write((const uint8_t *)buffer, size);
56+
}
5457

5558
size_t print(const __FlashStringHelper *);
5659
size_t print(const String &);

0 commit comments

Comments
 (0)