1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/os/bare/bare_example_linux.v

21 lines
375 B
V
Raw Normal View History

2019-11-15 03:17:47 +03:00
fn syscall5(number, arg1, arg2, arg3, arg4, arg5 voidptr) voidptr
2019-11-16 23:22:40 +03:00
fn write(fd int, data voidptr, nbytes int) int {
2019-11-15 03:17:47 +03:00
return syscall5(
1, // SYS_write
fd,
data,
nbytes,
0, // ignored
0 // ignored
)
}
fn main() {
2019-11-16 23:22:40 +03:00
write(1, c'hello\n', 6)
s := 'test string'
write(1, s.str, s.len)
a := s[0]
2019-11-15 03:17:47 +03:00
}