c - From []byte to char* -
i want wrap c function takes char* pointing (the first element of) non-empty buffer of bytes. i'm trying wrap in go function using cgo can pass []byte, don't know how conversion. simplified version of c function's signature is
void foo(char const *buf, size_t n); i tried passing pointer first byte in slice with
c.foo(&b[0], c.size_t(n)) that doesn't compile, though:
cannot use &b[0] (type *byte) type *_ctype_char in function argument so what's correct procedure here? go-wiki describes reverse situation.
Comments
Post a Comment