Writing encrypted files

Posted by BuzzBeeSi on May 20, 2001


i have spent hours fiddling about with code and i can't figure out how to write files. i just looked at a couple of other posts and they worked! however, i would like to know how to write a file in .dat format or something, where u can't make any sense at all out of it


Re: webmaster Guido on May 22, 2001

What in fact are you looking for? A way to encrypt a .TXT file? Or do you want to encrypt any type of file, textfiles as well as all other types?

I ask this, because in Delphi there is quite a difference between dealing with "text" files and dealing with all other types of files (non-text files, also called "binary" files).

.DAT is not a format, it's just a file extension that is often used by programmers to store data in their own format. I mean, it's not like .XLS (MS Excel text) or .DOC (MS Word) or .BMP (BitMaP file), which are formats defined by MicroSoft.

For a file with an extension that is not "registered" with the user's Windows system, Windows does not know what applicaion to start when the user double-clicks the file. What extensions are registered, can be very different on 2 PC's. For example, I can register the extension .DAT and tell Windows to open all .DAT files with NotePad.

The other way around, you always can launch an application like NotePad or MS-Word and try to "open" any type of file (you also can tell Windows to "open with" after double-clicking a file in Explorer). Opening a .BMP file with NotePad usually doesn't give you any readable text, unless of course you have *written* text in the file! For example, if you have saved a text as MYTEXT.TXT with NotePad and next renamed it to MYPICTURE.BMP.

That's all very general, I know, but maybe it helps you in rewriting your question in more specific words ;)
Please, don't hesitate to ask again!