diff options
Diffstat (limited to 'file.c')
| -rw-r--r-- | file.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,32 @@ +#include <errno.h> +#include <string.h> + +#include "file.h" +#include "print.h" + +long +file_size(FILE * const file) +{ + fpos_t p; + + if ((fgetpos(file, &p) != 0) + || (fseek(file, 0L, SEEK_END) != 0)) { + return -1; + } + + const long size = ftell(file); + + if (fsetpos(file, &p) != 0) { + return -1; + } + + return size; +} + +FILE * +file_open(const char * const path, const char * const mode) +{ + /* TODO: odstranit tuto funkciu? */ + FILE * f = fopen(path, mode); + return f; +} |
