Mercurial > hg > dmlib
view testfs.c @ 0:32250b436bca
Initial re-import.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 28 Sep 2012 01:54:23 +0300 |
parents | |
children |
line wrap: on
line source
#include "d_fs.h" #include <stdarg.h> #include <stdio.h> void dream_error(const char *pFmt, ...) { va_list myAP; fprintf(stderr, "testfs: "); va_start(myAP, pFmt); vfprintf(stderr, pFmt, myAP); va_end(myAP); fprintf(stderr, "\n"); } int main(void) { DINT iResult; t_d_file *f; /* Initialize dreamFS */ iResult = dream_fs_init(DTRUE, DFALSE); fprintf(stderr, "dream_fs_init(): %i\n", iResult); if (iResult != DREAM_ERR_OK) return 1; /* File reading test, output "README" to stdout */ f = dfopen("README"); if (!f) fprintf(stderr, "dfopen() failed\n"); else { fprintf(stderr, "dfopen(%s) ok, fops = %p\n", f->pcFilename, f->fops); dfclose(f); } /* Try opening a file which is not in the PACK */ f = dfopen("jeejee.jpg"); if (!f) fprintf(stderr, "dfopen() failed\n"); else { fprintf(stderr, "dfopen(%s) ok, fops = %p\n", f->pcFilename, f->fops); dfclose(f); } f = dfopen("jeejee.jpgz"); if (!f) fprintf(stderr, "dfopen() failed (as expected)\n"); else { fprintf(stderr, "dfopen(%s) ok, fops = %p\n", f->pcFilename, f->fops); dfclose(f); } fprintf(stderr, "dream_fs_close()\n"); dream_fs_close(); return 0; }