Advertisement
Guest User

Untitled

a guest
May 4th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. int main(int argc, char *argv[])
  2. {
  3. // Check for arguments and file pointer omitted
  4. FILE *f = fopen(argv[1], "r");
  5. char *times;
  6. int i = 0;
  7.  
  8. for (i = 0; i < 2000; i++)
  9. {
  10. char line[80];
  11. if (fgets(line, 80, f) == NULL)
  12. break;
  13.  
  14. //I want every line with the text "</time> to be added to string times
  15. if(strstr(line, "</time>"))
  16. {
  17. times = strcat(times, line); //This line is my problem
  18. }
  19. }
  20.  
  21. printf(times);
  22.  
  23. fclose(f);
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement