X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/a988e1ea05cda557de9b42feeef376ca7502ca54..245faf8ef108ab45b6276848abe7462109194c36:/src/vfile/vfile.c?ds=inline diff --git a/src/vfile/vfile.c b/src/vfile/vfile.c index aafb851..444deb2 100644 --- a/src/vfile/vfile.c +++ b/src/vfile/vfile.c @@ -22,7 +22,7 @@ * Autores: Leandro Lucarella *---------------------------------------------------------------------------- * - * $Id: bufford.c 624 2004-05-30 20:18:04Z llucare $ + * $Id$ * */ @@ -127,12 +127,20 @@ int vfputc(int c, VFILE* vfp) size_t vfread(void* ptr, size_t size, size_t nmemb, VFILE* vfp) { - return 0; + int i = 0; + size_t total = size * nmemb; + /* leo uno a uno y si hay error salgo. */ + while (i < total && (((char*)ptr)[i++] = vfgetc(vfp)) != EOF); + return i % size; } size_t vfwrite(const void *ptr, size_t size, size_t nmemb, VFILE* vfp) { - return 0; + int i = 0; + size_t total = size * nmemb; + /* escribo uno a uno y si hay error salgo. */ + while (i < total && (vfputc(((char*)ptr)[i++], vfp)) != EOF); + return i % size; } int vfvol_close(VFILE* vfp)