Hello forums. I was making some adjustments to a Caesar Cipher to allow for it to read a .txt file. However, after having saved the file in numerous places, including the directory where Code:Blocks is saved, I was still not able to get it to work. Can someone please take a look at my code and tell me if the code actually works?
Code:#include<stdio.h> #include<conio.h> #include<string.h> void main() { int shift, i; char code[30]; FILE*fp; fp=fopen("caesarText","r"); if(fp ==NULL){ printf("Error opening input file \"caesarText\"!\n"); return 0; } else{ printf("Enter how much you would like to shift the text: /n"); scanf("%d", &shift); { for(i=0;i<strlen(code);i++) { if(code[i]==' '){} else { if (code[i]>='x') { code[i]=code[i]-26; } code[i]=code[i]+shift; } } } printf("Your encrypted text is: %s", code); getch();} }