You can use a StringBuilder instead of a byte array. The framework marshals StringBuilders to char*s. You'll have to modify your API declaration though.