Hi,
> i have a little problem to convert a C char array to a string array in
> golang
>
Maybe something like
var offset = unsafe.Sizeof(uintptr(0))
func argv2go(argv **C.char) []string {
var out []string
for *argv != nil {
out = append(out, C.GoString(*argv))
argv = (**C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(argv)) +
offset))
}
return out
}
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.