Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. int main(int argc, char *argv[]) {
  7.  
  8. char *tab;
  9.  
  10. FILE *p;
  11.  
  12. tab = malloc(150*sizeof(char));
  13.  
  14.  
  15. if((p = fopen("pliki2.txt","a")) == NULL){
  16.  
  17. printf("GUWNO\n");
  18. exit(1);
  19. }
  20.  
  21. int i = 0,j = 0;
  22.  
  23. while(i != 1) {
  24.  
  25. scanf("%c",&tab[j]);
  26. fprintf(p,"%c",tab[j]);
  27.  
  28. if(tab[j] == '.'){
  29. i++;
  30. j++;
  31.  
  32. }
  33. else{
  34. j++;
  35. }
  36.  
  37. }
  38.  
  39.  
  40.  
  41.  
  42. free(tab);
  43. fclose(p);
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement