Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <fcntl.h>
  2. #include <stdio.h>
  3. #include "get_next_line.h"
  4. int main(int argc, char **argv)
  5. {
  6.     char *line;
  7.     int fd;
  8.     int rd;
  9.  
  10.     line = "hello";
  11.     if (argc < 2)
  12.         return (-1);
  13.     fd = open(argv[1], O_RDONLY);
  14.     while ((rd = get_next_line(42 , &line)) > 0)
  15.     {
  16.         printf("%s\n", line);
  17.         free(line);
  18.     }
  19.     get_next_line(42, &line);
  20.     printf("%s", line);
  21.     get_next_line(42, &line);
  22.     printf("%s", line);
  23.     get_next_line(42, &line);
  24.     printf("%s", line);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement