-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaux.c
45 lines (41 loc) · 1000 Bytes
/
aux.c
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
42
43
44
45
#include "aux.h"
void write_elm_arr(char fileString[], void *arr, int size)
{
FILE *file = fopen(fileString, "wb");
if (file == NULL)
{
perror("Error opening file");
}
fwrite(arr, sizeof(f_elm_t), size, file);
fclose(file);
}
void write_int_arr(char fileString[], void *arr, int size)
{
FILE *file = fopen(fileString, "wb");
if (file == NULL)
{
perror("Error opening file");
}
fwrite(arr, sizeof(int), size, file);
fclose(file);
}
void read_elm_arr(char fileString[], void *arr, int size)
{
FILE *file = fopen(fileString, "rb");
if (file == NULL)
{
perror("Error opening file");
}
size_t read = fread(arr, sizeof(f_elm_t), size, file);
fclose(file);
}
void read_int_arr(char fileString[], void *arr, int size)
{
FILE *file = fopen(fileString, "rb");
if (file == NULL)
{
perror("Error opening file");
}
size_t read = fread(arr, sizeof(int), size, file);
fclose(file);
}