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/']
Windows uses an ACL (Access Control List) to control access to a file (or other kernel object). You can get the ACL for a file with [`GetFileSecurity`](http://msdn.microsoft.com/en-us/library/aa446639(VS.85).aspx) (you want the DACL, not the SACL). You can then get the actual permissions (rights) from that with [`GetEffectiveRightsFromAcl`](http://msdn.microsoft.com/en-us/library/aa446637(VS.85).aspx).

This has a race condition, so it's rarely a good idea though. In particular, between the time you retrieve the DACL and the time you try to do something with the file, the DACL may have changed, so what you retrieved is no longer correct.
I read in the link you provided that among others, file permissions as implemented in `_stat` and friends are UNIX specific and are left unused for NTFS, FAT and other Windows filesystems.

I think you will have more luck reading file permissions using the classic [FindFirstFile](http://msdn.microsoft.com/en-us/library/aa364418(VS.85).aspx) and related functions. You'll need to process the handle returned with functions described [here](http://msdn.microsoft.com/en-us/library/aa364399(v=VS.85).aspx)
These are highly unportable, but as C++ has no filesystem support, they are the only good choice.