diff options
| author | Charles <sircharlesaze@gmail.com> | 2019-07-16 12:58:13 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2019-07-16 12:58:13 +0200 |
| commit | 14914f50c3de6c5444e13cf67db064b03c1c90ef (patch) | |
| tree | 3ecf5a41b4541980ba0287a431681cd5ae25ad84 /c10/ex01/helper.c | |
| parent | 217bcb0d4e3ba60604921cb40d5a11a64f93cfc7 (diff) | |
| download | piscine-14914f50c3de6c5444e13cf67db064b03c1c90ef.tar.gz piscine-14914f50c3de6c5444e13cf67db064b03c1c90ef.tar.bz2 piscine-14914f50c3de6c5444e13cf67db064b03c1c90ef.zip | |
c09 passed, c10 start, exam00 and exam01
Diffstat (limited to 'c10/ex01/helper.c')
| -rw-r--r-- | c10/ex01/helper.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/c10/ex01/helper.c b/c10/ex01/helper.c new file mode 100644 index 0000000..8a1c13e --- /dev/null +++ b/c10/ex01/helper.c @@ -0,0 +1,35 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* helper.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2019/07/16 10:14:16 by cacharle #+# #+# */ +/* Updated: 2019/07/16 10:26:44 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include <unistd.h> +#include <errno.h> +#include <string.h> +#include "include.h" + +void ft_putstr_err(char *str) +{ + while (*str) + write(STDERR_FILENO, str++, 1); +} + +void handle_error(char *program_name, char *arg) +{ + char *error_msg; + + ft_putstr_err(program_name); + ft_putstr_err(": "); + ft_putstr_err(arg); + ft_putstr_err(": "); + error_msg = strerror(errno); + ft_putstr_err(error_msg); + ft_putstr_err("\n"); +} |
