Files
libucore/include/ucore_read_file.h
T
Nils O. Selåsdal 4dca24953f readd include dir
2012-11-15 17:30:40 +01:00

21 lines
691 B
C

#ifndef UCORE_READ_FILE_H_
#define UCORE_READ_FILE_H_y
#include <stddef.h>
/** Read the content of a file.
* The returned char* is malloced memory and must be freed by the caller.
* The content is terminated by a nul byte, regardless of whether the content
* is binary or text. The returned length does not include this nul byte.
*
* @param file_name name of the file
* @param length Returned length of the content read
* @param max Fail if the read content length is greater than max.
* @return The content read from the file, or NULL if something failed
* (inspect errno to see why it failed)
*/
char *
uc_read_file(const char *file_name, size_t *length, size_t max);
#endif