ft_printstr -> ft_puts
This commit is contained in:
parent
43532b9779
commit
5cbf5f4b5d
|
@ -12,19 +12,20 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_putchar(char c)
|
||||
{
|
||||
write(1, &c, 1);
|
||||
}
|
||||
|
||||
void ft_putstr(char *str)
|
||||
{
|
||||
while (*str)
|
||||
write(1, str++, 1);
|
||||
ft_putchar(*str++);
|
||||
ft_putchar('\n');
|
||||
}
|
||||
|
||||
/* ////
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
ft_putstr(argv[0]);
|
||||
ft_putstr("\n");
|
||||
ft_puts(argv[0]);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
|
@ -12,21 +12,24 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_printstr(char *str)
|
||||
void ft_putchar(char c)
|
||||
{
|
||||
while (*str)
|
||||
write(1, str++, 1);
|
||||
write(1, "\n", 1);
|
||||
write(1, &c, 1);
|
||||
}
|
||||
|
||||
void ft_puts(char *str)
|
||||
{
|
||||
while (*str)
|
||||
ft_putchar(*str++);
|
||||
ft_putchar('\n');
|
||||
}
|
||||
|
||||
/* ////
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (++i < argc)
|
||||
ft_printstr(argv[i]);
|
||||
ft_puts(argv[i]);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
|
@ -12,18 +12,21 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_printstr(char *str)
|
||||
void ft_putchar(char c)
|
||||
{
|
||||
while (*str)
|
||||
write(1, str++, 1);
|
||||
write(1, "\n", 1);
|
||||
write(1, &c, 1);
|
||||
}
|
||||
|
||||
void ft_puts(char *str)
|
||||
{
|
||||
while (*str)
|
||||
ft_putchar(*str++);
|
||||
ft_putchar('\n');
|
||||
}
|
||||
|
||||
/* ////
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
while (--argc)
|
||||
ft_printstr(argv[argc]);
|
||||
ft_puts(argv[argc]);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
void ft_printstr(char *str)
|
||||
void ft_puts(char *str)
|
||||
{
|
||||
while (*str)
|
||||
write(1, str++, 1);
|
||||
write(1, "\n", 1);
|
||||
write(1, '\n', 1);
|
||||
}
|
||||
|
||||
int ft_strcmp(char *s1, char *s2)
|
||||
|
@ -51,12 +51,10 @@ void ft_sort_str_tab(int size, char **tab)
|
|||
swap_reset(&idx, &tab[idx], &tab[idx + 1]);
|
||||
}
|
||||
|
||||
/* ////
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
ft_sort_str_tab(--argc, ++argv);
|
||||
while (argc--)
|
||||
ft_printstr(argv[argc]);
|
||||
ft_puts(argv[argc]);
|
||||
return (0);
|
||||
}
|
||||
*/ ////
|
||||
|
|
Loading…
Reference in New Issue