to modify a file containing an integer and doubling it
#include<stdio.h>
int main()
{
FILE *ptr;
FILE *fptr;
int n;
ptr=fopen("double.txt","r");
fscanf(ptr,"%d",&n);
fclose(ptr);
fptr=fopen("double.txt","w");
fprintf(fptr,"%d",2*n);
fclose(fptr);
}
Comments
Post a Comment