Вот как выглядит моя новая функция шифрования
void encrypt(char filePath[],int key) {
FILE * fileR;
FILE * fileW;
char dest[500],src[4];
int byte;
fileR = fopen(filePath,"r");
//Combines filePath with ext for unique filename
strcpy(dest,filePath);
strcpy(src,ext);
fileW = fopen(strcat(dest,src),"w");
while( (byte = fgetc(fileR)) != EOF) {
fputc(byte+key,fileW);
}
fclose(fileR);
fclose(fileW);
}
Теперь она работает так, как задумано.