I am trying to read a .init configuration file in C ++ with content.
[Ipaddress]
Ipaddress = 169.254.115.22
[ScanConfiguration]
Scanfrequency = 2500
ScanResolution = 2500
StartAngle = 700000
StopAngle = 1100000
So far, I have used this code to read data. My project has a Unicode character set and therefore, L is used before string values.
int iScanFreq =GetPrivateProfileInt(L"ScanConfiguration",L"Scanfrequency", 2500, L"filename.ini");
int iScanRes =GetPrivateProfileInt(L"ScanConfiguration",L"ScanResolution", 2500, L"filename.ini");
int iStartAngle =GetPrivateProfileInt(L"ScanConfiguration",L"StartAngle", -450000, L"filename.ini");
int iStopAngle =GetPrivateProfileInt(L"ScanConfiguration",L"StopAngle", 2250000, L"filename.ini");
But I get only the default values in the variables, and not the correct values from the file. I haven't done anything with the registry yet. Is there something that I have to do in the registry to get the correct value.
Any suggestions would be helpful Thanks.
source
share