Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main(){
- FILE *fp;
- int i=0;
- fp = fopen ("BD", "r");
- if (fp == NULL) {
- fp = fopen ("BD", "w");
- fprintf(fp, "%d",i);
- }
- fscanf(fp,"%d",&i);
- i++;
- fclose(fp);
- fp= fopen("BD", "w");
- fprintf(fp,"%d",i);
- printf("%d",i);
- //while()
- fclose (fp);
- char c[20];
- itoa(i,c,10);
- fp=fopen(c,"w");
- char tecla;
- char texto[300];
- while(tecla!=27){
- fgets(texto,300,stdin);
- puts(texto);
- fprintf(fp,"%s",texto);
- scanf("%c",tecla);
- }
- fclose (fp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement