Random Access I/O

Chris Williams via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Mar 25 17:10:23 PDT 2016


I need to be able to perform random access I/O against a file, 
creating a new file if it doesn't exist, or opening as-is (no 
truncation) if it already exists.

None of the access modes for std.stdio.File seem to allow that. 
Any usage of the "w" mode causes my code to consider the file 
empty if it pre-exists (though, it doesn't always actually 
truncate the disk on file?)

If I was coding in C, I would use open() as it gives more options 
for access:

http://pubs.opengroup.org/onlinepubs/009695399/functions/open.html

However, I don't see this exposed in phobos anywhere?


More information about the Digitalmars-d-learn mailing list