Mercurial > hg > dmlib
view testfs.c @ 315:ec70ae5aaa1a
Oops, resource file output was missing a linefeed.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 13 Oct 2012 07:23:13 +0300 |
parents | 32250b436bca |
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; }