On Fri, 17 Oct 2014 15:24:21 +0000 Lucas Burson via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> So given the below buffer would I use fromStringz (is this in the > stdlib?) to cast it from a null-terminated buffer to a good > string? Shouldn't the compiler give a warning about casting a > buffer to a string without using fromStringz? if you are really-really sure that your buffer is null-terminated, you can use this trick: import std.conv; string s = to!string(cast(char*)buff.ptr); please note, that this is NOT SAFE. you'd better doublecheck that your buffer is not empty and is null-terminated.
signature.asc
Description: PGP signature