/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/27 14:05:49 by ljiriste #+# #+# */
-/* Updated: 2023/06/27 17:28:04 by ljiriste ### ########.fr */
+/* Updated: 2023/06/28 21:24:50 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
return ;
}
-void tail_file(char *file_name, char *proc_name, unsigned int char_count);
+void write_last_chars(int fd, unsigned int fl, unsigned int chars)
+{
+
+void tail_file(char *file_name, char *proc_name, unsigned int char_count)
{
int fd;
- char c;
unsigned int file_length;
fd = open(file_name, O_RDWR);
else
{
file_length = file_length(file_name);
-
- while (read(fd, &c, 1) > 0)
- write(1, &c, 1);
+ write_last_chars(fd, file_length, char_count);
close(fd);
}
}