Here is the format of the file that is being read:
type                                                           Extensions
application/mathematica                        nb ma mb
application/mp21                                   m21 mp21
I am able to read each entry from the file.
Now I want to make a key-value pair where the output for the above entries would be like 
{nb: application/mathematica}
{ma:application/mathematica}
 and so on.
this is my current code to simply read through the entries
 char buf[MAXBUF];
 while (fgets(buf, sizeof buf, ptr) != NULL)
    {
        if(buf[0] == '#' || buf[0] == '\n')
            continue;  // skip the rest of the loop and continue
        printf("%s\n", buf);
}
 
    