diff options
Diffstat (limited to 'c')
-rw-r--r-- | c/data.h | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -84,20 +84,21 @@ struct FileView static FileView Initialized(const wchar_t* filename, size_t c, size_t cInit = 0) { - bool bExisting = GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES; - FileView fv(filename, c); - /* If file didn't exist, initialize it with defaults. */ - if (!bExisting) { + if (cInit && GetFileAttributes(filename) == INVALID_FILE_ATTRIBUTES) { + FileView fv(filename, c); T t; cInit = cInit? cInit: c; for (size_t i = 0; i < cInit; i++) memcpy(fv+i, &t, sizeof(T)); } - return fv; + return { filename, c }; } + FileView(FileView<T>&) = delete; + FileView(FileView<T>&& fv) = delete; + FileView(const wchar_t* filename, size_t c) : c(c) { hf = CreateFile(filename, GENERIC_READ|GENERIC_WRITE, |