I have one question: Why use stdout and fstream in the same program? I really donn't understand, you include fstream, don't include cstdio, use printf, and don't use fstream!
Thanks for pointing that out I revised the code.
To encrypt/decrypt data windows has cryptography functions built in, in linux you could use OpenSSL functions.
I would like use crypto++.
also how do I create a pipe because I want to encrypt the out put before its save to a file.