On Thursday, 30 December 2021 at 17:52:20 UTC, eugene wrote:
everything as needed.

Nevertheless, I do have zeroes in the buffer, so:

```d
import std.stdio;
import std.string;

void main() {
    ubyte[8] b = [0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x00, 0x00];
    /* "hello\n\0\0" */

    char[] s = cast(char[])b[0 .. $];
    writefln("'%s, world'", s.strip("\n\x00"));
}
```

much better than my initial

```d
char[] s = cast(char[])ioCtx.buf[0 .. strlen(cast(char*)ioCtx.buf.ptr) - 1];
```

Reply via email to