Click to See Complete Forum and Search --> : Files


Fadi500
November 7th, 2002, 08:13 AM
hi there,
my problem is that i want to save a file but i dont want it to be able to open from dos (by type or edit) or from windows (by a word program) i just want it to be opened from my program.
if the answer is to write (ios::binary) well i tried it but nothing
happened.

fadi

AlionSolutions
November 7th, 2002, 09:09 AM
Hi,
I don't think that there is a easy way to implement what you want.

files are basically files for the filesystem of your OS. There are no special filetypes that can be used for your purpose... just files.

So what ? why shouldn't someone try to open your files with a wrong application ?

you know the effect if you try to open a binary (exe etc.) file with an ASCII-Editor ? yess only crappy chars that are of no use.

so if you encrypt your files with a simple mechanism it will be very, very hard for someone to get a bit of structured information.

Greets

Juergen

Fadi500
November 7th, 2002, 10:24 AM
Thanks for your coeperation
first of all i want to know what is the real effect of:
(ios::binary)
because i noticed no difference
second :how can i encrypt the file
thanks again
Fadi

anujseth
November 9th, 2002, 01:00 PM
If you plan to encrypt the file, you could use a block cipher algorithm like AES to help you achieve this. Your program could have a secret key which is used to encrypt/decrypt the data.

My website (http://www.anujseth.com/crypto/blockciphers/aes.html) has links to a few C/C++ implementations of AES.

BUT: The file can still be opened by other programs -- only difference being that the contents would seem to be junk to them as it would be encrypted. :)