TR181-XPON
1.4.0
TR-181 PON manager.
|
#include <stdbool.h>
#include <stddef.h>
Go to the source code of this file.
Functions | |
bool | write_file (const char *const path, const char *const value) |
bool | read_first_line_from_file (const char *const path, char *line, size_t len) |
Helper functions to read and write files.
Definition in file file_utils.h.
bool read_first_line_from_file | ( | const char *const | path, |
char * | line, | ||
size_t | len | ||
) |
Read the first line from a file into a buffer passed by caller.
[in] | path | file path |
[in,out] | line | function reads 1st line from path and puts it in this parameter |
[in] | len | length of line |
Definition at line 212 of file file_utils.c.
bool write_file | ( | const char *const | path, |
const char *const | value | ||
) |
Write the string value to the file path.
[in] | path | file path |
[in] | value | value to write to path |
If path already exists and has value as contents, the function immediately returns true to avoid an unneeded write.
The function first writes the value to the file path with ".tmp" appended. Then it renames the file to path.
Avoid writing the file if the file already exists and already has the value of the parameter 'value' as contents.
Definition at line 154 of file file_utils.c.