elelomb

ita_ingl

May 7th, 2019
94
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. #include<stdlib.h>
  3. #include<string.h>
  4.  
  5. #define FILE_INPUT "fin.txt"
  6. #define FILE_OUTPUT "fout.txt"
  7.  
  8. #define STRLEN 256
  9.  
  10. typedef FILE* pfile;
  11. typedef char* pchar;
  12.  
  13. int main(void)
  14. {
  15. char s[STRLEN];
  16. pchar p1;
  17. pfile pfin, pfout;
  18.  
  19. if((pfin=fopen (FILE_INPUT, "r"))==NULL) goto fopen_err;
  20. if((pfout=fopen(FILE_OUTPUT, "w"))==NULL) goto fopen_err;
  21.  
  22. do
  23. {
  24. fscanf(pfin, "%s",s);
  25. for(p1=s; *p1!=','; p1++);
  26. *p1='.';
  27. fprintf(pfout,"%s\n",s);
  28.  
  29. }
  30. while ((strcmp(s,"NULL")!=0));
  31.  
  32. fclose (pfin);
  33. fclose (pfout);
  34. return EXIT_SUCCESS;
  35.  
  36. fopen_err:
  37. {
  38. printf("c'รจ un problema nell'apertura del file.\n");
  39. return EXIT_FAILURE;
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment