1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#ifndef _COMMON_FILE_H_ #define _COMMON_FILE_H_ #include <stdio.h> #include <stdbool.h> inline static bool file_exists(const char *filename) { FILE *f = fopen(filename, "r"); if (f) { fclose(f); return true; } return false; } #endif