Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
std.mmfile
Read and write memory mapped files.
License:
Authors:
Walter Bright,
Matthew Wilson
Source std/mmfile.d
- class
MmFile; MmFileobjects control the memory mapped file resource.- enum
Mode: int; - The mode the memory mapped file is opened with.
read- Read existing file
readWriteNew- Delete existing file, write new file
readWrite- Read/Write existing file, create if not existing
readCopyOnWrite- Read/Write existing file, copy on write
- this(string
filename); - Open memory mapped file
filenamefor reading. File is closed when the object instance is deleted.Throws:std.file.FileException - this(string
filename, Modemode, ulongsize, void*address, size_twindow= 0); - Open memory mapped file
filenameinmode. File is closed when the object instance is deleted.Parameters:string filenamename of the file. If null, an anonymous file mapping is created.Mode modeaccess modedefined above.ulong sizethe sizeof the file. If 0, it is taken to be thesizeof the existing file.void* addressthe preferred addressto map the file to, although the system is not required to honor it. Ifnull, the system selects the most convenientaddress.size_t windowpreferred block sizeof the amount of data to map at one time with 0 meaning map the entire file. Thewindowsizemust be a multiple of the memory allocation pagesize.Throws:std.file.FileException - const @property ulong
length(); - Gives size in bytes of the memory mapped file.
- Mode
mode(); - Read-only property returning the file
mode. - void[]
opSlice(); - Returns entire file contents as an array.
- void[]
opSlice(ulongi1, ulongi2); - Returns slice of file contents as an array.
- ubyte
opIndex(ulongi); - Returns byte at index
iin file. - ubyte
opIndexAssign(ubytevalue, ulongi); - Sets and returns byte at index
iin file tovalue.
Copyright © 1999-2018 by the D Language Foundation | Page generated by
Ddoc on Tue Mar 13 17:32:07 2018