I have below lines in my code written in C on unix platform. Please let me know why I am getting core dumped in closedir() function. I could successfully opened the directory specified by path.
if (opendir(MyDir) != NULL )
{
closedir((DIR *) MyDir);
exit 0;
}