mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: re-apply C++ support
This commit is contained in:
@ -6,10 +6,11 @@ pub fn hostname() ?string {
|
||||
mut name := [256]byte
|
||||
// https://www.ietf.org/rfc/rfc1035.txt
|
||||
// The host name is returned as a null-terminated string.
|
||||
res := C.gethostname(&name, 256)
|
||||
namebp := byteptr(name)
|
||||
res := C.gethostname(namebp, 256)
|
||||
if res != 0 {
|
||||
return error('net.hostname: failed with $res')
|
||||
}
|
||||
return tos_clone(name)
|
||||
return tos_clone(namebp)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user