Esempio n. 1
0
func GetString(dataRef DataRef) string {
	length := int(C.XPLMGetDatab(C.XPLMDataRef(dataRef), nil, 0, 0))
	valueBuffer := (*C.char)(C.malloc(C.size_t(length)))
	defer C.free(unsafe.Pointer(valueBuffer))
	C.XPLMGetDatab(C.XPLMDataRef(dataRef), unsafe.Pointer(valueBuffer), 0, C.int(length))
	return C.GoString(valueBuffer)
}
Esempio n. 2
0
func GetData(dataRef DataRef) []byte {
	length := int(C.XPLMGetDatab(C.XPLMDataRef(dataRef), nil, 0, 0))
	result := make([]byte, length)
	C.XPLMGetDatab(C.XPLMDataRef(dataRef), unsafe.Pointer(&result[0]), 0, C.int(length))
	return result
}