return fwrite_str(path, digit_buf);
}
+int fwrite_array(const char *path, const void *array,
+ const size_t size_of_elem,
+ const size_t numb_of_elem)
+{
+ _cleanup_fclose_ FILE *f = NULL;
+ int ret;
+
+ assert(path);
+ assert(array);
+
+ f = fopen(path, "w");
+ ret_value_errno_msg_if(!f, -errno,
+ "Failed open %s file", path);
+
+ ret = fwrite(array, size_of_elem, numb_of_elem, f);
+ ret_value_errno_msg_if(ret != numb_of_elem, -errno,
+ "Failed write array into %s file", path);
+
+ return RESOURCED_ERROR_NONE;
+}
+
int fread_str(const char *path, char **str)
{
_cleanup_fclose_ FILE *f = NULL;
return RESOURCED_ERROR_NONE;
}
-int fwrite_array(const char *path, const void *array,
- const size_t size_of_elem,
- const size_t numb_of_elem)
-{
- _cleanup_fclose_ FILE *f = NULL;
- int ret;
-
- assert(path);
- assert(array);
-
- f = fopen(path, "w");
- ret_value_errno_msg_if(!f, -errno,
- "Failed open %s file", path);
-
- ret = fwrite(array, size_of_elem, numb_of_elem, f);
- ret_value_errno_msg_if(ret != numb_of_elem, -errno,
- "Failed write array into %s file", path);
-
- return RESOURCED_ERROR_NONE;
-}
-
/* reads file contents into memory */
char* cread(const char* path)
{
int fwrite_ulong(const char *path, const unsigned long number);
+int fwrite_array(const char *path, const void *array,
+ const size_t size_of_elem,
+ const size_t numb_of_elem);
+
int fread_str(const char *path, char **str);
int fread_int(const char *path, int32_t *number);
int fread_ulong(const char *path, unsigned long *number);
-int fwrite_array(const char *path, const void *array,
- const size_t size_of_elem,
- const size_t numb_of_elem);
-
char *cread(const char *path);
char *cgets(char **contents);