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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user