C strings are 0-terminated. Either encode 0 (byte) values, or call with pointer
to first byte, and the length.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to go
the error occur because there is 0 in my byte array . Do i need to encode
it then?
On Wed, Jun 14, 2017 at 9:16 PM, andrey mirtchovski
wrote:
> can you show us a complete example with a stub C function? in
> particular the conversion to (*C.char) from unsafe.Pointer(&data[0])
> should work. comp
Both should work. What is your C function?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https
can you show us a complete example with a stub C function? in
particular the conversion to (*C.char) from unsafe.Pointer(&data[0])
should work. compare the first four bits at that address with the
first four bits you're receiving on the C side. they should be
identical. e.g.: https://play.golang.or
I have a byte array of image in golang , i have to pass this array to my C
function as char* . I did he following ,
data, err := ioutil.ReadAll(out.Body)
str := fmt.Sprintf("%s",data)
s:=C.main1(C.CString(str))
s:=C.main1((*C.char)(unsafe.Pointer(&data[0])))
but