C++ File IO Operations

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 3
Reputation: namita.mundada is an unknown quantity at this point 
Solved Threads: 0
namita.mundada namita.mundada is offline Offline
Newbie Poster

C++ File IO Operations

 
0
  #1
Jan 5th, 2009
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?
Last edited by namita.mundada; Jan 5th, 2009 at 2:50 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: C++ File IO Operations

 
0
  #2
Jan 5th, 2009
So are you asking how to change the file access permissions in c++ using windows XP/vista? maybe?
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 3
Reputation: namita.mundada is an unknown quantity at this point 
Solved Threads: 0
namita.mundada namita.mundada is offline Offline
Newbie Poster

Re: C++ File IO Operations

 
0
  #3
Jan 5th, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: C++ File IO Operations

 
0
  #4
Jan 5th, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 3
Reputation: namita.mundada is an unknown quantity at this point 
Solved Threads: 0
namita.mundada namita.mundada is offline Offline
Newbie Poster

Re: C++ File IO Operations

 
0
  #5
Jan 5th, 2009
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC