"wallacej" <ja*************@yahoo.co.uk> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Hi
Is there a way to protect system files, eg .ini files but still allow
access to them from C++ code?
As an example I have a settings file called SIMS.INI. This file is
often accessed through C++ using FILE and fstream. I do not want a
user to be able to open/edit/delete etc. this file.
Thanks
You'd need to ask in a newsgroup for the platform (Windows), not here. File
permissions are platform-specific.
But... there are a couple options, at least. One would be to not use a text
file, but instead use a binary file, and encode the contents in some simple
manner so that it's not easily readable by your users. Another might be to
mark it as read-only (using whatever system API calls are available on
Windows), such that the user gets a "hint" that it shouldn't be touched.
That wouldn't stop them if they really wanted to, but it might help. Or,
you could hide your file in some Windows-specific directory, and give it a
name they would never associate with your application. Or any combination
of the above.
In any case, you need to ask in a windows newsgroup if you've got questions
specific to that operating system.
-Howard