// Kotlin Native version 0.3 import kotlinx.cinterop.* import win32.* fun main(args: Array) { for (i in 0 until (80 * 25)) print("A") // fill 80 x 25 console with 'A's println() memScoped { val conOut = GetStdHandle(-11) val info = alloc() val pos = alloc() GetConsoleScreenBufferInfo(conOut, info.ptr) pos.X = (info.srWindow.Left + 3).toShort() // column number 3 of display window pos.Y = (info.srWindow.Top + 6).toShort() // row number 6 of display window val c = alloc() val len = alloc() ReadConsoleOutputCharacterW(conOut, c.ptr, 1, pos.readValue(), len.ptr) if (len.value == 1) { val ch = c.value.toChar() println("The character at column 3, row 6 is '$ch'") } else println("Something went wrong!") } }