On Tuesday, 19 February 2013 at 19:06:47 UTC, jerro wrote:
D doesn't use null termination for it's strings, strings are immutable(char)[]. You can form a D slice from a pointer by going
slice = ptr[0..length]
where length is the length of the array the pointer represents.
You can't just take a c style string and expect writeln to work with it.

You can use std.conv.to to convert a C string to a D string.

Good to know.

If you do know the length beforehand though, slicing will O(1) as opposed to O(n)

Reply via email to