Last active
March 13, 2017 17:25
-
-
Save charlesetc/a97eb43d71a2e66d8a37705de5a375e3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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