On Sunday, 23 April 2017 at 11:17:37 UTC, Mafi wrote:
Hi there,
every time I want to use output-ranges again they seem to be broken in a different way (e.g. value/reference semantics). This time it is char types and encoding.

[...]

Use sformat:

import std.format, std.stdio;

void main() {
        char[20] buffer;
        sformat(buffer, "Long string %s\n", "more more more");
        write(buffer);
}

Note: the buffer is not large enough to hold the entire string in your example so this will cause a stack buffer overflow.

Reply via email to