I am having a little trouble getting the my program to check whether or not a .ini file is empty or contains the path to a webpage.
My .ini file:
[WEB]
Location =
The following is my code. It will not enter the if statement and show the Dialogbox:
GetPrivateProfileStringA("WEBSERVICES", "Location", "none set", webLocation, sizeof(webLocation), pathStr);
if (webLocation == "1"){
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
EnableMenuItem(hmenu, ID_WEBSERVICES_RUN, MF_GRAYED);
}
Any help on this issue would be appreciated.
Regards
-Dan.
The
ifcondition is incorrect, usestrcmp()to comparechararrays:This:
compares the address of
webLocationto the address of the string literal"1", which always will befalse(in this case).Note that the section name
WEBdoes not match that specified in the call toGetPrivateProfileStringA().