Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/SoftEtherVPN/libhamcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavide Beatrici <git@davidebeatrici.dev>2021-03-09 07:23:37 +0300
committerDavide Beatrici <git@davidebeatrici.dev>2021-03-09 07:23:37 +0300
commit95ae85a8ef45d11e222acc8021bc35c55ae39fa6 (patch)
tree3919d6e67187f14b6c1aa31f3e9ebed57b01a710 /FileSystem.c
parent2c6d6148939bc77d1a0e7d3d3fbbbc3409d05114 (diff)
Import project
Diffstat (limited to 'FileSystem.c')
-rwxr-xr-xFileSystem.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/FileSystem.c b/FileSystem.c
new file mode 100755
index 0000000..b691746
--- /dev/null
+++ b/FileSystem.c
@@ -0,0 +1,41 @@
+#include "FileSystem.h"
+
+FILE *FileOpen(const char *path)
+{
+ if (!path)
+ {
+ return NULL;
+ }
+
+ return fopen(path, "rb");
+}
+
+bool FileClose(FILE *file)
+{
+ if (!file)
+ {
+ return false;
+ }
+
+ return fclose(file) == 0;
+}
+
+bool FileRead(FILE *file, void *dst, const size_t size)
+{
+ if (!file || !dst || size == 0)
+ {
+ return false;
+ }
+
+ return fread(dst, 1, size, file) == size;
+}
+
+bool FileSeek(FILE *file, const size_t offset)
+{
+ if (!file)
+ {
+ return false;
+ }
+
+ return fseek(file, offset, SEEK_SET) == 0;
+}