You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we pass buffer size to getBytes() accordingly to declared array size (buffer[bufSize]) then last index will be null. We must explicitly pass to getBytes() value [bufSize + 1] to properly get all bytes. This is not clear to use without take a look inside to getBytes() method.
For example:
String text{ "ABCDE" };
uint8_t buffer[text.length()] = {};
text.getBytes(buffer, text.length() + 1);
The text was updated successfully, but these errors were encountered:
When we pass buffer size to getBytes() accordingly to declared array size (buffer[bufSize]) then last index will be null. We must explicitly pass to getBytes() value [bufSize + 1] to properly get all bytes. This is not clear to use without take a look inside to getBytes() method.
For example:
String text{ "ABCDE" };
uint8_t buffer[text.length()] = {};
text.getBytes(buffer, text.length() + 1);
The text was updated successfully, but these errors were encountered: