diff options
author | Pixel <Pixel> | 2002-05-23 14:07:46 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2002-05-23 14:07:46 +0000 |
commit | bdbd7e1296b98081794e0b185a0b8b677c811359 (patch) | |
tree | 18b17064b2b5026d3272ac573b6728fed418c476 /fileutils.cpp | |
parent | 983358288de02d3bbf09a007f67d6f7d01bc2eff (diff) |
Again FILE * removing... this is boring!
Diffstat (limited to 'fileutils.cpp')
-rw-r--r-- | fileutils.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fileutils.cpp b/fileutils.cpp index 62e2c0b..b04a414 100644 --- a/fileutils.cpp +++ b/fileutils.cpp @@ -21,8 +21,33 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <unistd.h> #include "generic.h" +unsigned long filesize(int f_iso) +{ + long curpos, length; + + curpos = lseek(f_iso, 0, SEEK_CUR); + length = lseek(f_iso, 0, SEEK_END); + lseek(f_iso, curpos, SEEK_SET); + return length; +} + +void copy(int s, int d, long size) { + long i; + unsigned char c; + long r; + + for (i = 0; (i < size) || (size < 0); i++) { + r = read(s, &c, 1); + if (r == 0) { + break; + } + write(d, &c, 1); + } +} + unsigned long filesize(FILE * f_iso) { long curpos, length; |