I want to store data that will be read from and written to by two executable files. This data file will be used to store settings that are common to both executables. To keep the user from inadvertantly modifying the data file, I would like to limit its write access. Ideally, the write access would be limited to the two executables. Also, it would be nice to have the data file be unreadable, encrypted, or un-openable to keep the user from viewing the data file. Is all of this possible? If so, which file type should I use to store the data?

Recommended Answers

All 6 Replies

All of those things will not stop the determined (or the incompetent) from modifying the file.

What's wrong with a nice simple text file, with a banner at the top which reads something like
# This file is auto-generated. Any changes you make could be lost
# or cause the programs to fail in unexpected ways.

It seems to work for a lot of other programs.

Thanks for your quick response to my first question. Would a text file be the most professional way to save the settings for an executable? I'll give an example to clarify what I mean by 'settings'. In IE7 under the tools menu, there is an option to turn the popup blocker on or off. When you make your selection(on/off), I'm guessing there is a value in a data file somewhere that is changed. I assume that there would be an if/then statement in the IE7 code based on this setting value. I have looked through the 'Internet Explorer' folder on my computer and can't find a text file. So, what kind of file is IE7 or most mainstream programs using to store user defined settings?

>Would a text file be the most professional way to save the settings for an executable?
Why wouldn't it be? If you don't need anything more sophisticated it would be unprofessional to push more of a solution than you require.

>So, what kind of file is IE7 or most mainstream programs using to store user defined settings?
If I were to guess, I'd guess that it's adding and updating keys in the registry. That's not a recommended practice.

> In IE7 under the tools menu, there is an option to turn the popup blocker on or off.
Windows has this massive global variable called the registry.

> Would a text file be the most professional way to save the settings for an executable?
In the absence of compelling alternative requirements, there's no need to make settings unreadable by using some proprietary encoding format. Even Microsoft is coming around to the idea that what users really like is nice open standards for storing THEIR data, not some proprietary binary format which changes every couple of years and renders their precious data obsolete (and unsupported).

Further, depending on your choice of programming language, it is likely you can find free software libraries that will store all your configuration data in a structured text file format, for example: XML or even (gasp!) INI.

commented: I like XML +12

Thanks to all for the advice. I consider this problem solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.