-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintf_utils.c
More file actions
56 lines (49 loc) · 1.36 KB
/
Copy pathprintf_utils.c
File metadata and controls
56 lines (49 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* printf_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lgomes-n <lgomes-n@student.42sp.org.br> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/06/29 17:51:28 by lgomes-n #+# #+# */
/* Updated: 2023/06/30 16:48:22 by lgomes-n ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
char *ft_strchr(const char *s, int c)
{
int i;
i = 0;
while (s[i] != '\0')
{
if (s[i] == (char)c)
return ((char *)&s[i]);
i++;
}
if (s[i] == (char)c)
{
return ((char *)&s[i]);
}
return (NULL);
}
int ft_putchar(char c)
{
write (1, &c, 1);
return (1);
}
int ft_putstr(char *s)
{
int i;
i = 0;
if (s == NULL)
{
write (1, "(null)", 6);
return (6);
}
while (s[i] != '\0')
{
ft_putchar(s[i]);
i++;
}
return (i);
}