Mercurial > trustbridge
diff common/listutil.h @ 769:44257ecdae6d
Make Read File public
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 10 Jul 2014 19:11:09 +0200 |
parents | bf54c9fc0d63 |
children | 78798d3af8f0 |
line wrap: on
line diff
--- a/common/listutil.h Thu Jul 10 19:10:23 2014 +0200 +++ b/common/listutil.h Thu Jul 10 19:11:09 2014 +0200 @@ -81,6 +81,20 @@ * */ char **get_certs_from_list (char *data, const size_t size); +/** + * @brief Read a file into memory. + * + * The caller needs to free data + * + * @param[in] fileName Name of the file. + * @param[out] data the file content + * @param[out] size size in bytes of the file content. + * @param[in] max_size the maximum amount of bytes to read. + * + * @return 0 on success an error code otherwise. + */ +int read_file(const char *file_name, char **data, size_t *size, + const size_t max_size); #ifdef __cplusplus } #endif