File.rawWrite

Calls $(CSTDIO fwrite) for the file handle. The number of items to write and the size of each item is inferred from the size and type of the input array, respectively. An error is thrown if the buffer could not be written in its entirety.

rawWrite always writes in binary mode on Windows.

struct File
void
rawWrite
(
T
)
(
in T[] buffer
)

Throws

ErrnoException if the file is not opened or if the call to fwrite fails.

Examples

static import std.file;

auto testFile = std.file.deleteme();
auto f = File(testFile, "w");
scope(exit) std.file.remove(testFile);

f.rawWrite("\r\n\n\r\n");
f.close();
assert(std.file.read(testFile) == "\r\n\n\r\n");

Meta