02-05-2026
32 lines
1.1 kB
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* io.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: mleitao <mleitao@student.42.fr> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2026/03/30 17:49:31 by mleitao #+# #+# */
9/* Updated: 2026/05/02 00:52:55 by mleitao ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "utils.h"
14
15int putnchar(char c, int n)
16{
17 int count;
18
19 count = 0;
20 while (n--)
21 {
22 if (write(STDOUT_FILENO, &c, 1) < 0)
23 return (-1);
24 count++;
25 }
26 return (count);
27}
28
29int putnstr(const char *s, int n)
30{
31 return (write(STDOUT_FILENO, s, n));
32}