-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharacters_generator.c
46 lines (43 loc) · 1.4 KB
/
characters_generator.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* characters_generator.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: xle-boul <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/13 11:18:56 by xle-boul #+# #+# */
/* Updated: 2022/02/21 21:18:02 by xle-boul ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdio.h>
#include "minitalk.h"
int main(int ac, char *av[])
{
int number;
unsigned char ascii;
ascii = 127;
printf("%c\n", ascii);
if (ac != 2)
{
write(1, "Format: ./a.out <number>\n", 26);
return (0);
}
number = ft_atoi(av[1]);
write(1, "\"", 1);
while (number)
{
if (32 <= ascii && ascii <= 126)
{
if (!(ascii == 34 || ascii == 33 || ascii == 96 || ascii == 59))
{
write(1, &ascii, 1);
number--;
}
}
ascii--;
if (ascii == 32)
ascii = 127;
}
write(1, "\"", 1);
return (0);
}