diff options
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -48,4 +48,14 @@ char *alloc_new_str_s(char *str, size_t size) char *alloc_new_str(char *str) { return alloc_new_str_s(str, strlen(str)); +} + +off_t file_size(const char *fname) +{ + struct stat st; + if ( !stat( fname, &st ) ) + { + return st.st_size; + } + return 0; //hehe if error or file is 0, same woop woop }
\ No newline at end of file |