Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Protecting files

Reply
Thread Tools

Protecting files

 
 
wallacej
Guest
Posts: n/a
 
      05-19-2005
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

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      05-19-2005
wallacej wrote:
> 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.


Is there a C++ _language_ question here somewhere that I am not seeing?
 
Reply With Quote
 
 
 
 
Howard
Guest
Posts: n/a
 
      05-19-2005

"wallacej" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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



 
Reply With Quote
 
Karl Heinz Buchegger
Guest
Posts: n/a
 
      05-19-2005
wallacej wrote:
>
> 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.


Then you should check what capabilities your operating system offers
to protect files.

Note: operating system, not C++

--
Karl Heinz Buchegger
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
wallacej
Guest
Posts: n/a
 
      05-19-2005
Cheers,

I thought that maybe there was some way to protect the file, un-protect
it for access and then re-protect it after; all within the C++
_language_ .

wallace

 
Reply With Quote
 
Thomas Matthews
Guest
Posts: n/a
 
      05-19-2005
wallacej wrote:

> Cheers,
>
> I thought that maybe there was some way to protect the file, un-protect
> it for access and then re-protect it after; all within the C++
> _language_ .
>
> wallace
>

Sorry, but the _standard_ C++ language only provides
a minimal interface for files. Protecting them, passwords,
and redirection are left for the operating system.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PWD protecting individual files. darrel ASP .Net 1 06-20-2006 09:45 PM
Protecting files tshad ASP .Net 1 12-23-2005 09:58 PM
Protecting files on the server. UJ ASP .Net 18 12-21-2005 08:33 PM
Protecting computer files and IE data Parko Computer Support 2 05-10-2004 10:09 AM
Protecting image files Ryan Moore ASP .Net 4 04-16-2004 08:12 PM



Advertisments