string or range of characters representing the file name
if present, the maximum number of bytes to read
Untyped array of bytes read.
FileException on error.
import std.utf : byChar; scope(exit) { assert(exists(deleteme)); remove(deleteme); } std.file.write(deleteme, "1234"); // deleteme is the name of a temporary file assert(read(deleteme, 2) == "12"); assert(read(deleteme.byChar) == "1234"); assert((cast(const(ubyte)[])read(deleteme)).length == 4);
std.file.readText for reading and validating a text file.
Read entire contents of file name and returns it as an untyped array. If the file size is larger than upTo, only upTo bytes are read.