[your code here]
Paul Backus
snarwin at gmail.com
Tue Jan 29 21:32:42 UTC 2019
On Tuesday, 29 January 2019 at 21:13:16 UTC, qjnr wrote:
> /* This is a very basic implementation of cat in the D
> programming language.
> For more info about the D programming language, visit
> https://dlang.org .
>
> Copyright (c) 2018 qjnr */
>
> [...]
It's more concise (and more efficient) to use ranges for this.
Here's an example from the documentation of std.stdio.File [1]:
// Efficient file copy, 1MB at a time.
import std.algorithm, std.stdio;
void main()
{
stdin.byChunk(1024 * 1024).copy(stdout.lockingTextWriter());
}
[1] https://dlang.org/phobos/std_stdio.html#.File.byChunk
More information about the Digitalmars-d
mailing list