Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5.  
  6.  
  7.  
  8. int main(int argc , char *argv[4])
  9. {
  10. FILE *f,*g;
  11. if (argc != 4) {
  12. printf("Utilizare: %s <sursa> <destinatie> %d \n",argv[0],argc);
  13. exit(EXIT_FAILURE);
  14. }
  15. f=fopen(argv[1],"r");
  16. g=fopen(argv[2],"w");
  17. int n =atoi(argv[3]);
  18. char a [100];
  19. int i =0;
  20. while (fgets(a,99,f))
  21. {
  22. if(n<=i)
  23. fputs(a,g);
  24. i++;
  25. }
  26.  
  27. fclose(f);
  28. fclose(g);
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement