Hi! Could anyone tell me how I can use an object t...
# kotlin-native
d
Hi! Could anyone tell me how I can use an object that I have a CPointer to? I'm trying to use the posix readdir method like so:
var entry = readdir(dp)
. The entry that is returned is a CPointer<dirent>. I want to use the dirent directly to get the name. One Attempt was to do this
val name = entry[0].d_name.toString()
, but that is giving me a useless string that looks like this "CPointer(raw=0x2904670)"
the ide seems to think that entry[0] is correct. So maybe it's just that I need a different method to convert d_name (CArrayPointer<ByteVar>) to a string.
d
Try
.toKString()
instead.
d
Thanks! That works. For some reason intellij doesn't recognize that it is valid.