Hi i’m a novice with Kotlin, especially native,
I’m trying to build a serial tty package for native to allow my kotlin apps to talk to arduino boards. Im using Linux64.
I cant get this to compile, it fails on both the readdir line complaining about missing types, and on the println line where it cannot find the .d_name member
My expectation is that it would print out all the filenames of the files in the /dev directory, anybody got any ideas, im a bit stuck on this.
import kotlinx.cinterop.CPointer
import platform.posix.*
fun main(args: Array) {
val devdir = opendir("/dev")
if(devdir != null) {
do {
val result? = readdir(devdir)
if (result != null) {
println(result.d_name )
}
} while( result != null)
}
}