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
I’m expecting to get as a result something like this:
ACDEFG
6
HIP
3
ACDEFG0HIP
10
But the result is:
ACDEFG
6
HIP
3
ACDEFG `ah
10
I.e. if I understand the problem correctly the String object keeps the right length of str3, but while copying the ‘\0’ it decides the string is over, but it’s not. So in str3 I get right symbols before ‘\0’ and some garbage after.
The text was updated successfully, but these errors were encountered:
Might this be because String::concat(cstr, len) uses strcpy() instead of memcpy()? strcpy() is not precisely good at copying char buffers which might contain null bytes...
(Also if memcpy is used instead it wouldn't be necessary to create a 2-byte array and adding a \0 for String::concat(char))
After uploading my sketch (using Arduino 1.6.8 and Arduino Uno),
I’m expecting to get as a result something like this:
ACDEFG
6
HIP
3
ACDEFG0HIP
10
But the result is:
ACDEFG
6
HIP
3
ACDEFG `ah
10
I.e. if I understand the problem correctly the String object keeps the right length of str3, but while copying the ‘\0’ it decides the string is over, but it’s not. So in str3 I get right symbols before ‘\0’ and some garbage after.
The text was updated successfully, but these errors were encountered: