Skip to content

Instantly share code, notes, and snippets.

@kesslern
Created February 4, 2018 04:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kesslern/743d5a3c07b8cfbd52e78ec5268a1dc8 to your computer and use it in GitHub Desktop.
Save kesslern/743d5a3c07b8cfbd52e78ec5268a1dc8 to your computer and use it in GitHub Desktop.
Read a directory's filenames in kotlin native
val dir = opendir("./")
if (dir != null) {
try {
var ep = readdir(dir)
while (ep != null) {
println(ep.pointed.d_name.toKString())
ep = readdir(dir)
}
} finally {
closedir(dir)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment