Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char name[100],target[100],ch,mod; //Declare Variables
- char key = 97;
- cout<<"Enter The Path Of A File Name Which Is To Be Decrypted : ";
- cin >> name;
- ifstream fin(name,ios::binary);
- if(!fin) //Open The Encryped File In A Binary Mode
- {
- cout<<"Error In Opening Of A File : ";
- _getch();
- return 1; //Show Error If File Does Not Exist
- } //Or Any Occurs In Opening Of A File
- cout<<"Enter The New Decrypted File Name : ";
- cin >> target;
- ofstream fout;
- fout.open(target,ios::binary); //Opens The Output File In An Binary Mode
- if(!fout)
- { //Show Error If Any Error Occurs In Opening Of A File
- cout<<"Error In Opening Of A Target File : ";
- _getch();
- return 1;
- }
- while(fin.get(ch))
- { //Opens The Encryped File
- if(ch==EOF)break;
- mod = ch + key;
- if ( mod > 255) mod -= 255;
- fout << mod;
- }
- fin.close(); //Close The EncryptedFile
- fout.close(); //Close Your OriginalDecrypted File
- cout<<"The File Is Being Decrypted............ ";
- _getch();
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement