configuration - How to access an integer value from a .ini file in C? -


i trying access values .ini file main program. ini file contains values , looks this:

 [number]  jump =4  [letters]  key=h,e,l,l,o 

i access in main program

 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 %s", returnletters);  printf("the number %d", returnjumpvalue); 

the printf statement verify read right values ini file. here return letters give right values, dont understand usage of getprivateprofileint

 returnletters= h,e,l,l,o 

i dont understand this. can tell me wrong here? getprivateprofileint here.

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 integer equivalent of string following specified key name in specified initialization file. if key not found, return value specified default value.


Comments