code wiki / _attic / _thrash_demo.nx

_thrash_demo.nx source

↩ module page · 13 lines · 324 B

1import "syscalls.nx" 2import "nx_narr.nx" 3func main() -> i64 { 4 let len_raw: *u8 = sys_mmap(16) 5 let len: *i64 = len_raw as *i64 6 *len = 0 7 let buf: *u8 = sys_read_file("/nonexistent_thrash_test_path" as *u8, len) 8 if buf == (0 as *u8) { 9 narr_flush() 10 return 7 11 } 12 return 0 13}