On Thursday, 30 December 2021 at 16:49:17 UTC, Tejas wrote:
```d
char[] s = cast(char[])ioCtx.buf[0 .. $];// please remember that in `[0 .. $]` last index is automatically `length - 1` but just buf[$] will be an error since there the actual `length` will be used
```

I _think_ the above code is correct, please verify

There is one pecularity:

```d
char[] s = fromStringz(cast(char*)ioCtx.buf.ptr);
writefln("got '%s' from '%s:%d'", s.strip, client.addr, client.port);
// strip works :)
```

```d
char[] s = cast(char[])ioCtx.buf[0 .. $];
writefln("got '%s' from '%s:%d'", s.strip, client.addr, client.port);
// strip does not work :(
```

Reply via email to