file_util.h
Go to the documentation of this file.
1 /*!**********************************************************************
2 *
3 * @copyright Copyright (C) 2016 Siemens Aktiengesellschaft.\n
4 * All rights reserved.
5 *
6 *************************************************************************
7 *
8 * @file file_util.h
9 * @date Oct 5, 2016
10 * @brief File utility module header file.
11 *
12 * This utility includes the functions for file handling.
13 *
14 ************************************************************************/
15 
16 #ifndef FILE_UTIL_H_
17 #define FILE_UTIL_H_
18 
19 #include "mcl/mcl_common.h"
20 
21 #include <sys/stat.h>
22 #include <sys/types.h>
23 #include <stdio.h>
24 
25 typedef struct stat mcl_stat_t;
26 
39 E_MCL_ERROR_CODE file_util_fopen(const char *file_name, const char *mode, void **file_descriptor);
40 
55 E_MCL_ERROR_CODE file_util_fopen_without_log(const char *file_name, const char *mode, void **file_descriptor);
56 
67 E_MCL_ERROR_CODE file_util_fclose(void *file_descriptor);
68 
80 E_MCL_ERROR_CODE file_util_fclose_without_log(void *file_descriptor);
81 
95 E_MCL_ERROR_CODE file_util_fwrite(const void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor);
96 
112 E_MCL_ERROR_CODE file_util_fwrite_without_log(const void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor);
113 
123 void file_util_fread(void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor, mcl_size_t *actual_count);
124 
136 E_MCL_ERROR_CODE file_util_fputs(const char *data, void *file_descriptor);
137 
152 E_MCL_ERROR_CODE file_util_fgets(char *data, mcl_size_t data_size, void *file_descriptor);
153 
165 E_MCL_ERROR_CODE file_util_fstat(void *file_descriptor, mcl_stat_t *file_attributes);
166 
177 E_MCL_ERROR_CODE file_util_fflush(void *file_descriptor);
178 
191 E_MCL_ERROR_CODE file_util_fflush_without_log(void *file_descriptor);
192 
204 
205 #endif //FILE_UTIL_H_
E_MCL_ERROR_CODE file_util_fgets(char *data, mcl_size_t data_size, void *file_descriptor)
Definition: file_util.c:135
void file_util_fread(void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor, mcl_size_t *actual_count)
Definition: file_util.c:105
E_MCL_ERROR_CODE file_util_fopen(const char *file_name, const char *mode, void **file_descriptor)
Definition: file_util.c:22
Common module interface header file.
E_MCL_ERROR_CODE file_util_fwrite_without_log(const void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor)
Definition: file_util.c:88
E_MCL_ERROR_CODE file_util_fflush(void *file_descriptor)
Definition: file_util.c:182
struct stat mcl_stat_t
Definition: file_util.h:25
E_MCL_ERROR_CODE file_util_fflush_without_log(void *file_descriptor)
Definition: file_util.c:192
E_MCL_ERROR_CODE file_util_fopen_without_log(const char *file_name, const char *mode, void **file_descriptor)
Definition: file_util.c:32
E_MCL_ERROR_CODE
MCL Error code definitions. Every function returning an error code uses this enum values...
Definition: mcl_common.h:137
E_MCL_ERROR_CODE file_util_fclose(void *file_descriptor)
Definition: file_util.c:52
E_MCL_ERROR_CODE file_util_fwrite(const void *data, mcl_size_t size, mcl_size_t count, void *file_descriptor)
Definition: file_util.c:78
E_MCL_ERROR_CODE file_util_fputs(const char *data, void *file_descriptor)
Definition: file_util.c:115
size_t mcl_size_t
Definition: mcl_common.h:38
mcl_uint8_t mcl_bool_t
Definition: mcl_common.h:47
mcl_bool_t file_util_check_if_regular_file(const mcl_stat_t *file_attributes)
Definition: file_util.c:216
E_MCL_ERROR_CODE file_util_fstat(void *file_descriptor, mcl_stat_t *file_attributes)
E_MCL_ERROR_CODE file_util_fclose_without_log(void *file_descriptor)
Definition: file_util.c:62