How to handle char* to string from C functions?

Gary Willoughby dev at nomad.so
Wed Jan 1 15:03:05 PST 2014


I'm calling an external C function which returns a string 
delivered via a char*. When i print this string out, like this:

char* result = func();

writefln("String: %s", *result);

I only get one character printed. I guess this is expected 
because i'm only returned a pointer to the first char. Instead of 
incrementing the pointer until i reach a null is there an easy 
way to convert this to a D string or get writeln to print the 
entire char array?


More information about the Digitalmars-d-learn mailing list