I work in Linux. In Linux with stat function, we can extract the permissions of a file.

Similarly how can we extract the permissions of a file in windows. 

\_stat function in msdn states that permission bits are set in the stat buffer. But it does not give how to extract them. 

<http://msdn.microsoft.com/en-us/library/14h5k7ff%28VS.71%29.aspx>
['https://Stackoverflow.com/questions/3449465', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/266836/']
The struct stat structure does *not* contain any file permission info on Windows. Windows security is far more convoluted, you'd need GetFileSecurity() to retrieve the DACL for the file. That's rarely done in a Windows program, you'd typically let Windows evaluate the effective permissions and deal with the "you can't do it" error return. ERROR\_ACCESS\_DENIED from GetLastError().
MSDN doesn't have nearly as many hyperlinks as it should, you need to search a little to find [`_stat` Structure `st_mode` Field Constants](http://msdn.microsoft.com/en-us/library/3kyc8381.aspx).

On both Unix and Windows, you only get the basic permissions of a file, not its access control lists. Since Windows uses ACLs a lot, `_stat` won't give you much useful information. You need to use native Windows API functions to get the ACL.