#include <stdio.h>
int main()
{
FILE *fin, *fout;
int n;
fin = fopen("input.txt", "r");
if(fin==NULL) {
printf("Unable to open input file\n");
exit(1);
}
fout = fopen("output.txt", "w");
if(fout==NULL) {
printf("Unable to open output file\n");
exit(1);
}
fscanf(fin, "%d", &n);
fprintf(fout, "%d", n); fflush(fout);
printf("Thanks for doing File I/O test.\n");
printf("Press enter to continue.."); getchar();
int ret = remove("output.txt");
if(ret == 0) {
printf("File deleted successfully\n");
} else {
printf("Error: unable to delete the file\n");
}
printf("Press enter to continue.."); getchar();
return 0;
}
10