diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-30 21:09:41 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-30 21:09:41 +0100 |
commit | a454f9e1f2b09d4799e8ac3c4a4eb62bbba7b823 (patch) | |
tree | 99c17c5dc928143645dee9c57d346f8f8c3e3607 /common/file.h | |
parent | 8b1de3b34222ec6d8e6c99f7897b9cbd5fbba264 (diff) | |
download | uwu-lang-a454f9e1f2b09d4799e8ac3c4a4eb62bbba7b823.tar.xz |
common/ refactoring
Diffstat (limited to 'common/file.h')
-rw-r--r-- | common/file.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/common/file.h b/common/file.h new file mode 100644 index 0000000..c5e8036 --- /dev/null +++ b/common/file.h @@ -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 |