[go-nuts] Right way to convert c char to golang bytes

2020-06-06 Thread Tamás Gulácsi
Use 1<<31 instead of 1024. And ifthe C side won't modify/free the *uchar, then you don't need the copy. -- 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-nut

[go-nuts] Right way to convert c char to golang bytes

2020-06-05 Thread Balaji Rajendran
I want to convert *C.uchar to bytes slice. I've tried C.GoBytes. But, C.GoBytes is not giving the exact result. Because, it is truncating at zero. for example. If I have *C.uchar like this, [1,3,5,0,2,4,5]. I expect my go bytes like this [1,3,5,0,2,4,5] But, I get [1,3,5,0,0,0] If I use C.Gob