Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
82
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<string.h>
  3. int main(){
  4. FILE *fp;
  5. int i=0;
  6. fp = fopen ("BD", "r");
  7. if (fp == NULL) {
  8. fp = fopen ("BD", "w");
  9. fprintf(fp, "%d",i);
  10. }
  11.  
  12. fscanf(fp,"%d",&i);
  13. i++;
  14. fclose(fp);
  15. fp= fopen("BD", "w");
  16. fprintf(fp,"%d",i);
  17. printf("%d",i);
  18. //while()
  19. fclose (fp);
  20. char c[20];
  21. itoa(i,c,10);
  22. fp=fopen(c,"w");
  23. char tecla;
  24. char texto[300];
  25. while(tecla!=27){
  26. fgets(texto,300,stdin);
  27. puts(texto);
  28. fprintf(fp,"%s",texto);
  29. scanf("%c",tecla);
  30. }
  31. fclose (fp);
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement