This might help.

import std.c.string;

void main() {
  // The input data:
  ubyte* ustr = cast(ubyte*) "bobcat\0".ptr;

  // Conversion to 'string'.
  char* cstr = cast(char*) ustr;
  string str = cast(string) cstr[0..strlen(cstr)];
  assert(str == "bobcat");
}

 - Vijay

On Wednesday, 14 November 2012 at 13:37:26 UTC, Knud Soerensen wrote:
Hi

I am working with a c library which return a unsigned char *

As suggested on http://digitalmars.com/d/1.0/htomodule.html

I have converted it to (ubyte *).

Now is there an easy way to convert this to a string ?

Knud


Reply via email to