]> git.lizzy.rs Git - uwu-lang.git/blobdiff - common/file.h
common/ refactoring
[uwu-lang.git] / common / file.h
diff --git a/common/file.h b/common/file.h
new file mode 100644 (file)
index 0000000..c5e8036
--- /dev/null
@@ -0,0 +1,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