I have created one binary file in c that save btree.
File is having huge size around 2GB.

If some one changes this attribute to read only, then b tree is updated incorrectly. And the behavior of code changes.

I need to write a code, so that no can change file's attributes such as read only, hidden, etc. from outside.

Can any one help me?

Recommended Answers

All 4 Replies

Member Avatar for iamthwee

So are you asking how to change the file access permissions in c++ using windows XP/vista? maybe?

Thanks for the reply :)
No, Actually one service dumps data to file, and I want when that service is been started, no one can change file attributes.
e.g. Suppose my service is dumping data to file, and same time if any one make that file read only, then service cant write data to it.
So actually it is giving me error.
Did you understand the problem?

You could probably use some calls to FindFirstChangeNotification, and WaitForSingleObject api calls. Then whenever your app notices a change to the file.. it automatically changes the permissions back. Though, if you have access to the service that dumps data to the file... why not make the service simply check the file permissions (and if needed, change them....) on the line just before it dumps data to the file?

Yes I checked for permissions, but som how some data is missing, and this file contains offset of database file in form of btree, so I am getting some wrong data.

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.