diff options
Diffstat (limited to 'src/gfile/inc_memfs.c')
-rw-r--r-- | src/gfile/inc_memfs.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/gfile/inc_memfs.c b/src/gfile/inc_memfs.c index baeb0e97..6177b7d8 100644 --- a/src/gfile/inc_memfs.c +++ b/src/gfile/inc_memfs.c @@ -26,8 +26,10 @@ static const GFILEVMT FsMemVMT = { 0, 0, 0, 0, 0, 0, MEMRead, MEMWrite, MEMSetpos, 0, 0, - 0, 0, - 0 + 0, 0, 0, + #if GFILE_NEED_FILELISTS + 0, 0, 0, + #endif }; static int MEMRead(GFILE *f, void *buf, int size) { @@ -43,3 +45,18 @@ static bool_t MEMSetpos(GFILE *f, long int pos) { (void) pos; return TRUE; } + +GFILE * gfileOpenMemory(void *memptr, const char *mode) { + GFILE *f; + + // Get an empty file and set the flags + if (!(f = findemptyfile(mode))) + return 0; + + // File is open - fill in all the details + f->vmt = &FsMemVMT; + f->obj = memptr; + f->pos = 0; + f->flags |= GFILEFLG_OPEN|GFILEFLG_CANSEEK; + return f; +} |