Path.openFile

Open file and return std.stdio.File struct with opened file

struct Path
@safe const
std.stdio.File
openFile
(
in string openMode = "rb"
)

Parameters

openMode string

string representing open mode with same semantic as in C standard lib fopen function.

Return Value

Type: std.stdio.File

std.stdio.File struct

Examples

import dshould;
Path root = createTempPath();
scope(exit) root.remove();

auto test_file = root.join("test-create.txt").openFile("wt");
scope(exit) test_file.close();
test_file.write("Test1");
test_file.flush();
root.join("test-create.txt").readFile().should.equal("Test1");
test_file.write("12");
test_file.flush();
root.join("test-create.txt").readFile().should.equal("Test112");

Meta