On Thursday, February 01, 2018 21:36:52 Jerry Ferris via Digitalmars-d-learn wrote: > Hello, > > I'm developing a program that will either receive data from stdin > or a file, and pass it along to a function for processing. I want > to place this data into a buffer so there only has to be one > version of the function. However, since I'm new to D, I'm unsure > how to go about this in the most idiomatic way. > > Thus my questions are: > * Is there a simpler way to copy a file's contents into a buffer?
If you want to copy an entire file into an array, then use std.file.read or std.file.readText. std.stdio.File only really makes sense if you're trying not to read the entire file into memory. - Jonathan M Davis