//Caesar encryptor program #include <stdio.h> #include "sys\stat.h" int main() { int data, output; long long int count=0; struct stat statbuf; char enc_file[260], dec_file[260]; int shift_phase; FILE * sourcefile; FILE * destfile; printf("\nShift phase: "); scanf("%d", &shift_phase); printf("\nFile path of target file: "); scanf("%s", enc_file); printf("\nOutput File Path: "); scanf("%s", dec_file); if ((sourcefile = fopen(enc_file, "rb"))== NULL) { printf("\nCan't open target file %s.\n", enc_file); return(4); } fflush(sourcefile); fstat(fileno(sourcefile), &statbuf); fclose(sourcefile); if ((sourcefile = fopen(enc_file, "rb")) == NULL) { printf("\nCan't open target file %s \n", enc_file); return(4); } if ((destfile=fopen(dec_file,"wb")) == NULL) { printf("\nCan't open destination file %s \n", dec_file); return(4); } while (count < (statbuf.st_size)) { data=fgetc(sourcefile); output=(data+shift_phase); fputc(output,destfile); count++; } fclose(sourcefile); fclose(destfile); return 0; }
C
VB.NET
10
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)