How to change DIRECTORY ATTRIBUTES through C or C++

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

Join Date: Sep 2004
Posts: 12
Reputation: riturajraina is an unknown quantity at this point 
Solved Threads: 0
riturajraina riturajraina is offline Offline
Newbie Poster

How to change DIRECTORY ATTRIBUTES through C or C++

 
0
  #1
Mar 23rd, 2005
Hi Friends,

Can anyone tell how to change the attributes of a directory through C or C++.

I have tried to found in my compiler's help file but it was showing the method to change the file attributes but not the directory's.

I want to change the attributes of a directory from Read/Write to Read only and vice versa in my program.

Please help.......

Thanks in Advance.

Regards
Rituraj Raina
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 11
Reputation: sinB is an unknown quantity at this point 
Solved Threads: 0
sinB sinB is offline Offline
Newbie Poster

Re: How to change DIRECTORY ATTRIBUTES through C or C++

 
0
  #2
Mar 23rd, 2005
You cannot make a directory readonly (at least, not in DOS). you can only make it's files and the files in it's subdirectories readonly. Even if you could make a directory readonly, it would be useless because directories are treated differently to files, even though they are just files with the directory attribute.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 53
Reputation: aj.wh.ca is an unknown quantity at this point 
Solved Threads: 1
aj.wh.ca aj.wh.ca is offline Offline
Junior Poster in Training

Re: How to change DIRECTORY ATTRIBUTES through C or C++

 
0
  #3
Mar 23rd, 2005
Originally Posted by riturajraina
Hi Friends,

Can anyone tell how to change the attributes of a directory through C or C++.

I have tried to found in my compiler's help file but it was showing the method to change the file attributes but not the directory's.

I want to change the attributes of a directory from Read/Write to Read only and vice versa in my program.

Please help.......

Thanks in Advance.

Regards
Rituraj Raina
I think there are couple of ways to do this. Simplest I think is use the system call and use OS specific command within. e.g system("attrib +r mydir") will make mydir read-only.

cheers,
aj.wh.ca
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 12
Reputation: riturajraina is an unknown quantity at this point 
Solved Threads: 0
riturajraina riturajraina is offline Offline
Newbie Poster

Re: How to change DIRECTORY ATTRIBUTES through C or C++

 
0
  #4
Mar 24th, 2005
Thanks a lot friends for your prompt help.

I think i have done a great exploration by finding this group.

I am sorry that i didn't explained my problem in detail in my last post.

Well better late than never.

Here it is.

Actually i am developing a project in which i have to keep the user's data in a folder which has been kept in a server(Win2k based) on my network.

The folder will be shared with all the users and all rights(read/write/modify etc.)will be granted to all the users on the folder(its a requirement of the my program).

Now my main worry is that since all the users will be granted full rights on the shared folders, hence if someone gets a mischief and he/she deletes all the contents of the shared folder , then all the userfull data of the users will be lost.

Hence i want to develop a mechanism in which only some users will be having all the rights while some users will be having readonly rights and I want this assignment of rights on the shared folder(installed on server) to be done through my C++ program (installed on client machines).

Can anyone suggest a remedy for this???

Thanks Again
Rituraj Raina
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 53
Reputation: aj.wh.ca is an unknown quantity at this point 
Solved Threads: 1
aj.wh.ca aj.wh.ca is offline Offline
Junior Poster in Training

Re: How to change DIRECTORY ATTRIBUTES through C or C++

 
0
  #5
Mar 25th, 2005
Hi Rituraj ,
Unless you have some other requirement for the program you are trying to develop I would call it re-inventing the wheel. For the purpose you have written, I would strongly suggest that you use Win2K control panel. You can easily assign rights on a folder (which has users data) on a per user basis. Its a very simple task that way.
regards,
aj.wh.ca
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 1
Reputation: boggsi is an unknown quantity at this point 
Solved Threads: 0
boggsi boggsi is offline Offline
Newbie Poster

Re: How to change DIRECTORY ATTRIBUTES through C or C++

 
0
  #6
May 22nd, 2005
hi, i am also interested in modifying a files attributes using C++. Symbian OS as far as I know how has no OS built in commands for modifying a files attributes... It works on the same basis of windows attributes, because files modified on an mmc by windows retain the same attributes in Symbian OS. I was wondering if anyone has a method coded into C++ for modiyfing file attributes, particularly hidden/not hidden...

Many thanks.
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC