+long vfsize(const char* path)
+{
+ VFILE* vfp = vfopen(path, "r", 0);
+ long size;
+ if (!vfp) return -1; /* error */
+ if (fseek(vfp->fp, 0l, SEEK_END) == -1)
+ {
+ vfclose(vfp);
+ return -1; /* error */
+ }
+ else
+ {
+ size = ftell(vfp->fp);
+ if (size == -1)
+ {
+ vfclose(vfp);
+ return -1; /* error */
+ }
+ }
+ while (!vfp->lastvol) /* mientras no sea el último volumen */
+ {
+ if (vfvol_open_next(vfp))
+ {
+ vfclose(vfp);
+ return -1; /* error */
+ }
+ if (fseek(vfp->fp, 0l, SEEK_END) == -1)
+ {
+ vfclose(vfp);
+ return -1; /* error */
+ }
+ else
+ {
+ long curr_size = ftell(vfp->fp);
+ if (curr_size == -1)
+ {
+ vfclose(vfp);
+ return -1; /* error */
+ }
+ size += curr_size;
+ }
+ if (vfvol_close(vfp))
+ {
+ vfclose(vfp);
+ return -1; /* error */
+ }
+ }
+ vfclose(vfp);
+ return size;
+}
+