string or range of characters representing the file name
data to be written to file
FileException on error.
scope(exit) { assert(exists(deleteme)); remove(deleteme); } int[] a = [ 0, 1, 1, 2, 3, 5, 8 ]; write(deleteme, a); // deleteme is the name of a temporary file const bytes = read(deleteme); const fileInts = () @trusted { return cast(int[]) bytes; }(); assert(fileInts == a);
Write buffer to file name.
Creates the file if it does not already exist.