Advertisement
Guest User

lab04

a guest
Mar 27th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. int main (int argc, char *argv[])
  7. {
  8.  
  9.     FILE *entrada;
  10.     FILE *saida;
  11.  
  12.     char str[1000];
  13.     char *new;
  14.  
  15.  
  16.     entrada = fopen(argv[1], "r");
  17.  
  18.     fgets(str,sizeof(str),entrada);
  19.  
  20.     new = strtok(str, " ,.;:()[]*?!-/\t\"");
  21.  
  22.     saida = fopen(argv[2], "w");
  23.  
  24.     fprintf(saida,"%s",new);
  25.  
  26.     while (new != NULL)
  27.     {
  28.         new = strtok(NULL, " ,.;:()[]*?!-/\t\"");
  29.         fprintf(saida, "\n");
  30.         fprintf(saida, "%s", new);
  31.  
  32.     }
  33.  
  34.     fclose(entrada);
  35.     fclose(saida);
  36.  
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement