Thanks,   C.GoBytes  Works well.

Another question.   How to convert  []byte   to   *byte   backward?



Ian Lance Taylor <i...@golang.org> 于2018年12月3日周一 下午1:01写道:

> On Sat, Dec 1, 2018 at 9:39 AM <leeoxi...@gmail.com> wrote:
> >
> > I am using swig wrap a c++ module , the generated go code is like this:
> >
> > type  MediaFrame interface {
> >      GetLength()  uint
> >      GetData()  (*byte)
> > }
> >
> > I want to convert the *byte  to []byte,  How to do this?
>
> One approach is
>
> s :=
> (*[1<<30]byte)(unsafe.Pointer(mf.GetData())[:mf.GetLength():mf.GetLength()]
>
> Ian
>

-- 
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