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

FileSystem.c - github.com/SoftEtherVPN/libhamcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b6917464e565b1e043a2167fc42290caa71b3bdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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;
}