commit a56df6a68aa105282f2e7590c3d817550e8123bd
parent 4ef75c1752b899d5354ef6a56ecab68fecdcd2ae
Author: Francesco Saccone <francesco@francescosaccone.com>
Date: Sun, 30 Mar 2025 20:15:13 +0200
feat: add file_exists function
Signed-off-by: Francesco Saccone <francesco@francescosaccone.com>
Diffstat:
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/file.c b/file.c
@@ -1 +1,7 @@
#include "file.h"
+
+int
+file_exists(const char *path) {
+ struct stat buffer;
+ return (stat(path, &buffer) == 0);
+}
diff --git a/file.h b/file.h
@@ -1,4 +1,7 @@
#ifndef FILE_H
#define FILE_H
+int
+file_exists(const char *path);
+
#endif