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

cgen_test: skip empty lines; os: make vc_gen compile

This commit is contained in:
Alexander Medvednikov
2020-01-01 12:50:25 +01:00
parent 78c706ab71
commit 47908c22df
6 changed files with 50 additions and 28 deletions

View File

@@ -216,3 +216,29 @@ pub fn symlink(origin, target string) ?bool {
if res == 0 { return true }
return error(get_error_msg(C.errno))
}
// convert any value to []byte (LittleEndian) and write it
// for example if we have write(7, 4), "07 00 00 00" gets written
// write(0x1234, 2) => "34 12"
pub fn (f mut File) write_bytes(data voidptr, size int) {
$if linux {
C.syscall(sys_write, f.fd, data, 1)
} $else {
C.fwrite(data, 1, size, f.cfile)
}
}
pub fn (f mut File) close() {
if !f.opened {
return
}
f.opened = false
$if linux {
//$if linux_or_macos {
C.syscall(sys_close, f.fd)
return
}
C.fflush(f.cfile)
C.fclose(f.cfile)
}