On Wednesday, May 1, 2019 at 7:06:47 AM UTC+12, Nitish Saboo wrote: > > Apologies.I did this 'strings.Split(C.GoString(*C.char),""). > I am getting 'Incompatible types' compilation error. >
Are you literally doing this? strings.Split(C.GoString(*C.char),"") Something like this should be working correctly: someCArr := getSomeCArr() chars := strings.Split(C.GoString(someCArr),"") Is your goal to split the string into a slice of individual characters? Because that is what your delim suggests. > Thanks > > > On Wed, May 1, 2019 at 12:30 AM Nitish Saboo <nitish...@gmail.com > <javascript:>> wrote: > >> Hi, >> >> I want to convert *C.char to array of strings in Go. >> I want to do this because I want the first word from the string.Strings >> are getting appended to *C.char and I want the first word of the string. >> I am doing it using 'strings.Split(C.GoString(*C.char))[0]', but it is >> giving error. >> Can someone correct me here ? >> >> Thanks >> >> -- >> 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 golan...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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.