Skip to content

Instantly share code, notes, and snippets.

@charlesetc
Last active March 13, 2017 17:25
Show Gist options
  • Save charlesetc/a97eb43d71a2e66d8a37705de5a375e3 to your computer and use it in GitHub Desktop.
Save charlesetc/a97eb43d71a2e66d8a37705de5a375e3 to your computer and use it in GitHub Desktop.
use "options"
use "path:sys/ioctl"
use @ioctl[None](file: I32, magic: U32, winsize: MaybePointer[Winsize])
struct Winsize
var height: U16 = 0
var width: U16 = 0
new create() => None
actor Main
new create(env: Env) =>
let size = Winsize.create()
let size_ptr = MaybePointer[Winsize](size)
@ioctl(0, 21523, size_ptr)
env.out.print("console height: " + size.height.string())
env.out.print("console width: " + size.width.string())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment