Disk fragmentation ratio in the NTFS file system

How can I find out Disk fragmentation ratio in the NTFS file system, in Linux or in Windows?
In C / C ++ or C#