diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index d3957201a..df41e86db 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -42,6 +42,18 @@ #include #include +off_t file_size(const char *filename) +{ + struct stat stat_buf; + if(::stat(filename, &stat_buf) == 0) + { + return stat_buf.st_size; + } else + { + return 0; + } +} + bool file_exists(const char *filename) { struct stat stat_buf; diff --git a/src/system/helpers.h b/src/system/helpers.h index c87adb71f..a811edab8 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -27,6 +27,7 @@ int my_system(int argc, const char *arg, ...); /* argc is number of arguments in FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type); int safe_mkdir(char * path); +off_t file_size(const char *filename); bool file_exists(const char *filename); void wakeup_hdd(const char *hdd_dir); int check_dir(const char * dir);