42_cub3d/read_all_text.h
2024-10-15 18:23:16 +02:00

29 lines
1.3 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* read_all_text.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mcolonna <mcolonna@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/02 15:39:02 by mcolonna #+# #+# */
/* Updated: 2024/10/02 17:04:33 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef READ_ALL_TEXT_H
# define READ_ALL_TEXT_H
/// @brief Size of buffer used in read_all_text().
# define BUFFER_SIZE 1000
/// @brief Read all the text of the given file.
///
/// If the last line isn't ended by a '\\n', add one.
///
/// If error, returns NULL and set errno accordingly.
///
/// @param fd File descriptor of the file.
/// @return Alloc'd string of the file content. NULL if error.
char *read_all_text(int fd);
#endif