473,395 Members | 2,713 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,395 software developers and data experts.

Hiding a file

In my application i write some vital data to a file (using fopen,
fwrite, etc etc). Is it possible to change the attributes of this
file(the program itself should be able to do it) so that the file is
hidden, and also if possible restrict the access of the file only to
the program which created it.

May 29 '06 #1
6 2063
Sync_net wrote:
In my application i write some vital data to a file (using fopen,
fwrite, etc etc). Is it possible to change the attributes of this
file(the program itself should be able to do it) so that the file is
hidden, and also if possible restrict the access of the file only to
the program which created it.


The ways to do what your asking for differ from operating system to
operating system. Standard C has no provisions to do what you're
asking. Post is a forum appropriate to the underlying operating system
over which your C program is targetted to run.

File hiding is generally useless and easily reversed. File access
permissions are easily set under UNIX and a bit harder to undo. If you
want to absolutely secure your data, encryption is the only feasible
method.

May 29 '06 #2
"Sync_net" <ri********@gmail.com> writes:
In my application i write some vital data to a file (using fopen,
fwrite, etc etc). Is it possible to change the attributes of this
file(the program itself should be able to do it) so that the file is
hidden, and also if possible restrict the access of the file only to
the program which created it.


There's no way to do this in standard C. Try a newsgroup that's
specific to your operating system.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
May 29 '06 #3

Sync_net wrote:
In my application i write some vital data to a file (using fopen,
fwrite, etc etc). Is it possible to change the attributes of this
file(the program itself should be able to do it) so that the file is
hidden, and also if possible restrict the access of the file only to
the program which created it.


You would need to invoke OS specific API calls. The call would depend
on what OS you are using. Hiding a file / restricting access is
generally not ir-reversible. You could think of possibly encrypting /
encoding the file.

May 29 '06 #4

encrypting would still not be completely usefull atleast in this case
since it wouldnt stop anyone from deleting the file.

Jaspreet wrote:
Sync_net wrote:
In my application i write some vital data to a file (using fopen,
fwrite, etc etc). Is it possible to change the attributes of this
file(the program itself should be able to do it) so that the file is
hidden, and also if possible restrict the access of the file only to
the program which created it.


You would need to invoke OS specific API calls. The call would depend
on what OS you are using. Hiding a file / restricting access is
generally not ir-reversible. You could think of possibly encrypting /
encoding the file.


May 31 '06 #5
Don't top-post. I've fixed your post.

Sync_net wrote:
Jaspreet wrote:
Sync_net wrote:
In my application i write some vital data to a file (using fopen,
fwrite, etc etc). Is it possible to change the attributes of this
file(the program itself should be able to do it) so that the file is
hidden, and also if possible restrict the access of the file only to
the program which created it.


You would need to invoke OS specific API calls. The call would depend
on what OS you are using. Hiding a file / restricting access is
generally not ir-reversible. You could think of possibly encrypting /
encoding the file.


encrypting would still not be completely usefull atleast in this case
since it wouldnt stop anyone from deleting the file.


Since standard C, (which is this group's topic), has no way to do the
things you want to do, it would be better if you took your question to
a forum specific to your target platform. Generally file protection is
provided by the operating system, for which specific APIs may need to
be called.

Ask in a more relevant forum.

May 31 '06 #6
Sync_net wrote:

Please don't top post. You reply belongs under the text you are replying
to, not above. I would have thought that reading posts here and seeing
how others reply might have given you a clue! I've fixed it this time.
Jaspreet wrote:
Sync_net wrote:
In my application i write some vital data to a file (using fopen,
fwrite, etc etc). Is it possible to change the attributes of this
file(the program itself should be able to do it) so that the file is
hidden, and also if possible restrict the access of the file only to
the program which created it.

You would need to invoke OS specific API calls. The call would depend
on what OS you are using. Hiding a file / restricting access is
generally not ir-reversible. You could think of possibly encrypting /
encoding the file.


encrypting would still not be completely usefull atleast in this case
since it wouldnt stop anyone from deleting the file.


Nothing you do will stop them from reformatting the drive, so you can't
completely prevent this. For what you can do you need system specific
APIs as Jaspreet said, and for those you need to go to a group dedicated
to your system.
--
Flash Gordon, living in interesting times.
Web site - http://home.flash-gordon.me.uk/
comp.lang.c posting guidelines and intro:
http://clc-wiki.net/wiki/Intro_to_clc
May 31 '06 #7

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

Similar topics

21
by: R. Rajesh Jeba Anbiah | last post by:
I'm supposed to hide the php extension in a file (like Yahoo! or Google). For example, http://foo.com/foo instead of http://foo.com/foo.php. I have read various articles including...
11
by: Lorenzo Villari | last post by:
I premise I don't know C++ well but... I wondered what is this data hiding thing... I mean, if I can look at the header (and i need it beacuse of the class), then what's hidden? Can someone give...
5
by: Amir S. | last post by:
Hi, I'm a newbie to C++ (2 weeks into the course). We were given this assignment to write some code that reads a set of integers (grades) from a file (filename passed by console), outputs them...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
11
by: sofeng | last post by:
I'm not sure if "data hiding" is the correct term, but I'm trying to emulate this object-oriented technique. I know C++ probably provides much more than my example, but I'd just like some feedback...
2
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means...
13
by: mattia | last post by:
Hi everybody, I'm wondering how to realize a simple pattern in C: information hiding, to hide detail implementations of a data structure. How can I do that? I've also read that is preferred to use...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
27
by: matt | last post by:
Hello group, I'm trying to become familiar with the information hiding design rules, and I have a lot (3) of questions for all you experts. AFAIK, a generic module has 2 files: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.