Open a stream for reading, read the file content into string, encrypt the string and write the string back. Same process for decrypting.
This might help: http://www.cplusplus.com/forum/windows/128374/
#include <iostream>
#include <fstream>
#include <iterator>
#include <algorithm>
usingnamespace std;
using it = istream_iterator<char>;
using ot = ostream_iterator<char>;
char encrypt( char c ) { return c + 1; } // I'm sure that you can do something more exciting
char decrypt( char c ) { return c - 1; } // Ditto
int main ()
{
ifstream in ( "infile.txt" ); it initer ( in );
ofstream out( "outfile.txt" ); ot outiter( out );
transform( initer, {}, outiter, encrypt );
}