Home
Highly Reusable Software By activity User Interface Text Strings Math Processing
Stored Data
Communications
Hard World File System
|
#License - #Source code - #Example Use -
#include <librock/mstruct.h> const char * librock_VSBreadfile(struct librock_VSB_s *v, /* Will be VSBrealloc'ed */ char *filename); /* file path */
The file is opened with open() using (O_RDONLY|librock_O_BINARY) flags.
On failure, one the following error explanation strings is returned;
"E-1-Could not open" "E-2-Could not fstat" "E-3-Could not realloc" "E-4-Read Error. Incomplete." Typical use is to initialize a memory block with the contents of a file. #ifdef librock_TYPICAL_USE_VSBreadfile #include <stdio.h> #include <librock/mstruct.h> struct librock_VSB_s *v; const char *err; v = librock_VSBalloc(); err = librock_VSBreadfile(v,"exec/struct/vsbrf.c"); if (err) { printf("%s\n",err); switch(atoi(err+1)) { case 1: /* "E-1-Could not open" */ break; case 2: /* "E-2-Could not fstat" */ break; case 3: /* "E-3-Could not realloc" */ break; case 4: /* "E-4-Read Error" */ break; } } else { printf("Read size: %d\n",v->inbuf); } librock_VSBfree(v); #endif
fstat open close read librock_VSBrealloc
Copyright 1998-2002 Forrest J. Cavalier III, http://www.mibsoftware.com Licensed under BSD-ish license, NO WARRANTY. Copies must retain this block. License text in <librock/license/librock.txt> librock_LIDESC_HC=12440211096131f5976d36be0cddca4cd9152e45
Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)
Want to help? We welcome comments, patches. -- Need help? Request paid support.