Repository navigation
Expand file tree
/
Copy pathft_toupper.c
More file actions
76 lines (65 loc) · 1.93 KB
/
Copy pathft_toupper.c
File metadata and controls
76 lines (65 loc) · 1.93 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* ************************************************************************** */
/* */
/* /#/ |#/|#| */
/* ft_toupper.c /#/ |/ |#| */
/* /#/ /#/ */
/* By: nepcohen <nepcohen@learner.42.tech> /#/ /#/ */
/* /#/____ |#| /| */
/* Created: 2026/05/11 20:05:27 by nepcohen |#######| |#|/#| */
/* Updated: 2026/05/13 03:08:50 by nephco |#| NEPH */
/* */
/* ************************************************************************** */
/* === PROG ================================================================= */
int ft_toupper(int c)
{
if(c >= 'a' && c <= 'z')
{
c = c - 32;
}
return (c);
}
/* === MAIN ================================================================= */
#include <unistd.h>
#include <stdio.h>
static void ft_putchar(char value)
{
write(1, &value, 1);
}
static void ft_putstr(char *str)
{
int count;
count = 0;
while(str[count] != '\0')
{
ft_putchar(str[count]);
count++;
}
}
static void display(char *play)
{
int count;
count = 0;
while(play[count] != '\0')
{
ft_putchar(ft_toupper(play[count]));
count++;
}
}
int main(int argc, char **argv)
{
char message[] = "Merci de saisir un argument";
if (argc == 2)
{
display(argv[1]);
ft_putchar('\n');
}
else
{
ft_putstr(message);
ft_putchar('\n');
}
return(0);
}
/* ========================================================================== */
/* === END ====================================================== 42_ ======= */
/* ============================================================== NEPHCODE == */