IMHO, ini's have been made obsolete by the registry. So, it's been a long time since I've worked with ini's. But I believe the following code snippet may be helpful.
Code:
#define MAX 8192
void ReadSections(char* IniPath)
{
LPTSTR lpszReturnBuffer;
lpszReturnBuffer = new TCHAR[MAX];
char* pNextSection = NULL;
GetPrivateProfileSectionNames(lpszReturnBuffer,MAX,IniPath);
pNextSection = lpszReturnBuffer;
printf("%s\n", pNextSection);
while (*pNextSection != 0x00)
{
pNextSection = pNextSection + strlen(pNextSection) + 1;
if(*pNextSection != 0x00)
{
printf("%s\n", pNextSection);
}
}
}