Chanjung Kim
02/15/2024, 9:40 PMByteArray
, you can memcpy
from that `CPointer<ByteVar>`:
val ptr: CPointer<ByteVar> = ...
val byteArray = ByteArray(bufferSize).apply {
usePinned { pinned ->
memcpy(pinned.getAddress(0), ptr, bufferSize)
}
}
jw
02/15/2024, 9:41 PMptr.readBytes(bufferSize)
will do all that for you and return a ByteArray
Chanjung Kim
02/15/2024, 9:53 PMCharArray
, is there a simple method like ptr.readBytes
but for CharArray
? I can see there is an internal method for that, but not a public one...Miroslav Sobotka
02/16/2024, 10:44 AM