Having problems with transferring a data from one text file to another. My idea is to transfer it per character but it seems to not be working. I have added these codes at the beginning
FILE *addressPtr;
FILE *ressPtr;
and
addressPtr = fopen("temporary.txt","w");
These set of codes are in a switch condition
fclose(addressPtr);
addressPtr = fopen("temporary.txt","r");
while((filechar = fgetc(addressPtr)) != EOF){
fclose(addressPtr);
ressPtr = fopen("Address Book.txt","a");
fprintf(ressPtr,"%c",filechar);
fclose(ressPtr);
addressPtr = fopen("temporary.txt","r");
}
printf("The file has been successfully saved!!");
I just learned about these file operations and dont really know what went wrong
If I open my Address Book.txt file it will only display the first character of my temporary.txt but continuously (never-ending).