Reputation: 967
I am trying to access values from my .ini file into my main program. The ini file just contains some values and looks like this:
[number]
jump =4
[letters]
key=H,E,L,L,O
I access it in my main program as
LPCSTR file= "C:Users:\\work\\Inifile.ini";
char returnletters[100];
int returnjumpvalue;
GetPrivateProfileString("letters", "key", 0, returnletters, 100, file);
GetPrivateProfileInt("number","jump",0,returnjumpvalue, file);
printf("The letters are %s", returnletters);
printf("The number is %d", returnjumpvalue);
THe printf statement is to verify that I read the right values for the ini file. However here the return letters give the right values, but I dont understand the usage of GetPrivateProfileInt
returnletters= H,E,L,L,O
I dont understand this. Can somebody tell me what is wrong here? The GetPrivateProfileInt is here.
Upvotes: 0
Views: 1540
Reputation: 1223
returnjumpvalue = GetPrivateProfileInt("number","jump",0, file);
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724345%28v=vs.85%29.aspx
Return value
The return value is the integer equivalent of the string following the specified key name in the specified initialization file. If the key is not found, the return value is the specified default value.
Upvotes: 1