Guest User

Untitled

a guest
Jun 21st, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. void main(int argc , char *argv[])
  4. {
  5.  
  6. FILE *file;
  7.  
  8. char *string[100];
  9. int count = 0,n=0;
  10.  
  11. // initialise file pointer to read
  12. file = fopen(argv[3],"r");
  13.  
  14. // string to int
  15. n = atoi(argv[2]);
  16.  
  17. // read character by character
  18. while(file , "%c" , string)!=EOF)
  19. {
  20. // break after n characters
  21. if(count == n)
  22. {
  23. break;
  24. }
  25. else
  26. {
  27. printf("%c" , line);
  28. }
  29. count++;
  30. }
  31.  
  32. fclose(file);
  33. }
Add Comment
Please, Sign In to add comment