11
11
#include "fileutils.h"
13
/*--------------------------------------*
14
* INTERNAL FUNCTIONS DECLARATIONS *
15
*--------------------------------------*/
17
static char * make_full_path (const char *dir,
21
13
/* ==================== BEGIN IMPLEMENTATION PART ==================== */
23
15
/*--------------------------------*
24
16
* FUNCTIONS IMPLEMENTATIONS *
25
17
*--------------------------------*/
28
make_full_path (const char *dir, const char *name, const char *ext)
32
path = (char *) malloc (strlen (dir) + strlen (name) + strlen (ext) + 2);
33
sprintf (path, "%s/%s%s", dir, name, ext);
39
file_open (const char *dir, const char *name, const char *ext, TrieIOMode mode)
45
if (mode & TRIE_IO_WRITE)
50
full_path = make_full_path (dir, name, ext);
51
file = fopen (full_path, std_mode);
52
if (!file && mode & TRIE_IO_CREATE)
53
file = fopen (full_path, "w+");
60
file_length (FILE *file)
65
cur_pos = ftell (file);
67
fseek (file, 0L, SEEK_END);
70
fseek (file, cur_pos, SEEK_SET);
76
20
file_read_int32 (FILE *file, int32 *o_val)