Skip to content

Opening std.stdio.File using a set of symbolic constants as a file access mode

License

Notifications You must be signed in to change notification settings

FreeSlave/openfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenFile

Build Status Windows Build Status Coverage Status

OpenFile library provides functions for opening std.stdio.File using a set of symbolic constants instead of C-style string as a file access mode. This approach allows setting a file access mode which is not possible or non-portable to express via string literals. E.g. an exclusive mode which atomically ensures that the file does not exist upon creating. Also someone might just prefer symbolic constants over string literals.

import openfile;

// Open a file in write mod and ensure that this is a new file with such name 
// avoiding an accidental change of data written by some other process and ensuring that no other file with such name exists at the time of opening.
File f = openFile("test.txt", OpenMode.createNew);

About

Opening std.stdio.File using a set of symbolic constants as a file access mode

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages