# Viewing/Changing File Attributes

This topic is 4561 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

So I want to be able to view and change the permissions for a specific file. And for some reason, I can't seem to find any info on this topic...
cout << GetFileAttributes("testText.txt") << endl;

This code prints out "32". I have NO idea what that means. Given enough time, I probably COULD figure it out on my own, but I'm feeling all that up to it at the moment. The other thing I'd like to know is about SetFileAttributes (if there IS one...). Basically, eveything about getting and setting file attributes. I'm going for the Windows solutino if possible. Windows XP preferably... Thanks...

##### Share on other sites
GetFileAttributes. You may also want to look at GetFileAttributesEx, SetFileAttributes and SetFileInformationByHandle.

Σnigma

##### Share on other sites
Quote:
 Original post by Spyder_SnyperSo I want to be able to view and change the permissions for a specific file. And for some reason, I can't seem to find any info on this topic...cout << GetFileAttributes("testText.txt") << endl;This code prints out "32". I have NO idea what that means. Given enough time, I probably COULD figure it out on my own, but I'm feeling all that up to it at the moment.The other thing I'd like to know is about SetFileAttributes (if there IS one...). Basically, eveything about getting and setting file attributes.I'm going for the Windows solutino if possible. Windows XP preferably...Thanks...

Here is a link that descibes the function. It has a link to SetFileAtrributes at the bottom. The return value is probably a bitmask.

For example:
DWORD value = GetFileAttributes( "isItADirectory" );if( value & FILE_ATTRIBUTE_DIRECTORY ){    std::cout << "File is a directory...\n";}

##### Share on other sites
Hey, PRIMO info... thanks a TON...

That link is EXACTLY what I was looking for...

1. 1
2. 2
Rutin
29
3. 3
4. 4
5. 5
khawk
14

• 11
• 11
• 23
• 10
• 9
• ### Forum Statistics

• Total Topics
633647
• Total Posts
3013108
×