473,414 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Protecting files

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

Jul 23 '05 #1
5 1908
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?
Jul 23 '05 #2

"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

Jul 23 '05 #3
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
kb******@gascad.at
Jul 23 '05 #4
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

Jul 23 '05 #5
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
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: nell | last post by:
Hi all, I've developed a testing application in python, and should supply it in a way that no one (lets say they are regular users) will understand it and edit it. The application source is all...
4
by: Jonathan Henderson | last post by:
Obfuscators aren't only used for protecting intellectual property. See the hacker demo at this link: http://www.preemptive.com/documentation/NetHackerDemo.html For those who don't know what...
3
by: netsurfer | last post by:
hi..I'm working on a project that requires files to be password protected on a UNIX based site. The people that own the web site want to be able to change the password every so often. ...
7
by: Shawn | last post by:
Hi. I have a folder that contains a lot of different documents. xls, .doc, .pdf etc. Different users have access to different documents. The problem is that if a user knows the name of a...
8
by: Iain Napier | last post by:
I'm in the middle of developing a website with a downloads section. It's a wad of educational software for an LEA which for obvious reasons needs password protecting. Users have to authenticate...
18
by: UJ | last post by:
Folks, We provide custom content for our customers. Currently we put the files on our server and people have a program we provide that will download the files. These files are usually SWF, HTML or...
1
by: darrel | last post by:
I need to be able to password protect individual pages. For instance: /protected.aspx?id=123 /protected.aspx?id=555 Both would need to be only accessible to two different people (with their...
22
by: flit | last post by:
Hello All, I have a hard question, every time I look for this answer its get out from the technical domain and goes on in the moral/social domain. First, I live in third world with bad gov., bad...
1
by: =?Utf-8?B?S2xhdXMgSmVuc2Vu?= | last post by:
Hi I have in the past had succes with protecting pdf-files from download by unauthenticated users by adding an application extension in IIS and mapping pdf.files to be served by the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.