func open_path(path: String, flags: Int, mode: Int) '[io, alloc] -> IntHigh-level open for Talk strings: copy the path into fresh memory with a NUL terminator (allocations are zero-filled, so the terminator comes free) and open through the C-string path.
View Source
pub func open_path(path: String, flags: Int, mode: Int) '[io, alloc] -> Int {
let buf = _alloc<Byte>(count: path.byte_count + 1)
_copy(from: path.storage.base, to: buf, length: path.byte_count)
let fd = _io_open(path: buf, flags: flags, mode: mode)
_free(ptr: buf)
fd
}