iopipe: Writing output to std.io File

Steven Schveighoffer schveiguy at gmail.com
Mon Jan 27 18:35:52 UTC 2020


On 1/27/20 1:12 PM, Steven Schveighoffer wrote:

> void writeln(Pipe)(ref Pipe sink, string text)
> {
>     enforce(sink.ensureElems(text.size) >= text.length); // make sure 
> there's enough buffer space to hold the text
>     sink[0 .. text.length] = text; // write to the buffer
>     sink.release(text.length); // release to be written
> }
> 

Ugh, should have tested.

sink.window[0 .. text.length] = text;

-Steve


More information about the Digitalmars-d-learn mailing list