Advertisement
Guest User

main.c

a guest
Jul 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. #include <stdlib.h>
  4. #include "header.h"
  5.  
  6. void    debug()
  7. {
  8.     write(1, "--- debug ---\n", 14);
  9. }
  10.  
  11. int     main()
  12. {
  13.     t_list  *list;
  14.     char    c;
  15.     char    *str;
  16.     int     len;
  17.  
  18.     str = NULL;
  19.     len = 0;
  20.     while (read(0, &c, 1))
  21.     {
  22.         ft_list_push_back(&list, c);
  23.         len++;
  24.     }
  25.     str = (char*)malloc(sizeof(char) * len + 1);
  26.     ft_list_to_str(list, str);
  27.  
  28.     printf("%s", str);
  29.     printf("size: %d\n", len);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement