I have a this C function 

int scan_bus(char *sbuf, int sbuflen, char* sn, char* ps)

I'm trying to call this that takes several char * byte buffers as arguments.


In Go, I have sbuf  in []byte slices. But I can't figure out how to pass 
these into the C function.

I've tried

    var (
        sbuf           = make([]byte, 8192)
        sn, product    string
    )
    
    devidx := C.scan_bus((*C.char(&sbuf[0])), C.int(cap(sbuf)), 
C.CString(sn), C.CString(product))


But go error 

invalid indirect of C.char(&sbuf[0]) (type C.char)
cannot convert &sbuf[0] (type *byte) to type C.char


Thank you.



-- 
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://groups.google.com/d/optout.

Reply via email to