Blocking editing program's files

Hi,

I have a software which creates and edits some text files and binary files.
Is there any option to avoid the user from editing those files directly?
I want those files to be edited only by the program.

Thanks!
No. But you can make it harder by using binary data instead of text. You can also use some kind of encryption and/or checksum.

What is it you are actually trying to protect against? If you just want to avoid that the user double clicks on the file and are able to modify the file in a text editor it should be enough using a binary file format that is not recognized by any program. If you prefer text I think it's usually enough to put a few zero bytes at the start of the file to make it not being recognized as a text file.

If the file is a saved game or some other document and you want to avoid that the user modify the file in a hex editor, then I would say just let the user mess with the files if he wants to. As long as it's a single player game or his own documents there are no harm to anyone else. If you really want you could use some kind of encryption. Something as simple as an XOR encryption should stop most people. A checksum could be used too, and it has the additional advantage of being able to spot accidental corruption of the files. This doesn't really stop anyone that knows about this stuff and are prepared to spend a bit of time.

To ensure the file is not modified I think you would have to avoid storing the file on the user's computer and instead store it on your own server.
Thanks.

About the encryption and the checksum, I've never used it with C++ files before. Do you have any recommended tutorial how to use it with C++?
Topic archived. No new replies allowed.