I want the function to exit (NOT continue) if the encryptedMess.t xt file does not exist!
Below is the code for this function and it is after line 15 where i need help:
Any help would be much appreciate!
Thanks
Below is the code for this function and it is after line 15 where i need help:
Code:
//Process of Decyption
void Decrypt()
{
char decrypted;
stringLoc =0;
char ch;
ifstream encryptedMess("encryptedMess.txt"); //Open Encrypted File message
if (!encryptedMess)
{
cout<<"Error opening the file"<<endl;
}
while (!encryptedMess.eof())
{
encryptedMess.get(ch);
decrypted = ch-difference;
cout<<decrypted;
}
encryptedMess.close();
cout<<endl<<endl;
//Save to text File
ofstream decryptedMess;
decryptedMess.open("decryptedMess.txt", ios::out);
decryptedMess<<decrypted;
decryptedMess.close();
}
Any help would be much appreciate!
Thanks
Comment