I want to copy a Go string into a char * via CGO.
Am I allowed to do this something like this?
func copy_string(cstr *C.char) {
str := "foo"
C.GoString(cstr) = str
}
I want to copy a Go string into a char * via CGO.
Am I allowed to do this something like this?
func copy_string(cstr *C.char) {
str := "foo"
C.GoString(cstr) = str
}
我想通过CGO将Go字符串复制到char *中。</ p>
我可以这样做吗?</ p>
func copy_string(cstr * C.char){
str:=“ foo”
C.GoString (cstr)= str
}
</ code> </ pre>
</ div>