Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include <stdlib.h>
  4.  
  5. #define ARRAY_MAX 100
  6.  
  7. int main() {
  8.  
  9. FILE *input, *output;
  10. char *token[100];
  11. char buf[100];
  12. int count = 0;
  13. input = fopen("/Users/home/Desktop/test.txt", "r");
  14. output = fopen("/Users/home/Desktop/test2.txt", "w");
  15.  
  16. while (fgets(buf, sizeof(buf), input) != NULL) {
  17. token[count] = strtok(buf, "n");
  18. ++count;
  19. }
  20.  
  21. for (int i = 0; i<count; i++) {
  22. printf("%sn", token[i]);
  23. }
  24.  
  25. printf("%dnn" ,count);
  26. return 0 ;
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement