- Linux Training
- Desktop Tutorials
- Server Tutorials
|Internal API Reference - File utilities|
|Desktop Apps Training - Policy Kit|
kit_bool_t kit_file_get_contents (const char *path,
Reads an entire file into allocated memory.
kit_bool_t kit_file_set_contents (const char *path,
Writes all of contents to a file named path, with good error checking. If a file called path already exists it will be overwritten. This write is atomic in the sense that it is first written to a temporary file which is then renamed to the final name.
If the file already exists hard links to path will break. Also since the file is recreated, existing permissions, access control lists, metadata etc. may be lost. If path is a symbolic link, the link itself will be replaced, not the linked file.