tizen 2.3 release
[kernel/api/system-resource.git] / src / common / file-helper.h
1 /*
2  * resourced
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20
21 /*
22  * @file file-helper.h
23  * @desc Helper functions for working with files
24  */
25
26 #ifndef _RESOURCED_FILE_HELPER_H_
27 #define _RESOURCED_FILE_HELPER_H_
28
29 #include "resourced.h"
30
31 /**
32  * @desc write string to the file
33  * @param path - path to the file, str - string is written to the file
34  * @return negative value if error
35  */
36 resourced_ret_c fwrite_str(const char *path, const char *str);
37
38 resourced_ret_c fwrite_int(const char *path, const int number);
39
40 resourced_ret_c fwrite_uint(const char *path, const u_int32_t number);
41
42 resourced_ret_c fread_int(const char *path, u_int32_t *number);
43
44 resourced_ret_c fwrite_array(const char *path, const void *array,
45                              const size_t size_of_elem,
46                              const size_t numb_of_elem);
47
48 char *cread(const char *path);
49 char *cgets(char **contents);
50 #endif  /*_RESOURCED_FILE_HELPER_H_*/