Best way to retrieve a string from C

A few solutions are available in previous threads: