I was under the impression that `String#encodeToBy...
# kotlin-native
l
I was under the impression that
String#encodeToByteArray
would add a null terminator, since it’s used by cstr, however, this does not appear to be the case. Should I manually add
0.toChar()
to each string I need to pass to C? I also noticed that ‘\0’ is not valid in Kotlin, saying it’s an illegal escape.
Looks like cstr adds 1 to the size when placing and manually sets the last byte, after writing the result of encodeToByteArray.
e
Kotlin doesn't have octal escapes, only hex unicode escapes (and a few named escapes). NUL char is
\u0000