Set file position to offset bytes from specified origin.
Write data to file starting at current file position.
VFSFile file; //initialized somewhere before auto output = file.output; with(output) { //Write to the file: write(cast(const void[])"The answer is ??"); //Change the last two characters in the file: seek(-2, Seek.End); write(cast(const void[])"42"); }
//Appending: //When appending to the file, every write writes to the end of file //regardless of any calls to seek(), and sets the file position //to end of file. This //(This is to stay in line with the C standard so we can use C functions directly) auto output = file.output(Yes.append); with(output) { //Append to the file: write(cast(const void[])"The answer is ??"); //This will NOT change the last 2 characters: it will append anyway: seek(-2, Seek.End); write(cast(const void[])"42"); }
Provides basic file output functionality - seeking and writing.
VFSFileOutput uses reference counting so that the file is closed when the last instance of VFSFileOutput provided by the file is destroyed.