Hi all,
I've spent almost an hour getting crazy why INI_GetKey not working anymore.
I've got a message from Bevan stating that he created a CLOCK.INI file in the same directory of thinBasic script he is doing and he was not able to read any of the keys inside that ini file while he was perfectly able to use INI_GetSectionsList or INI_GetSectionKeyList function. I made some tests and Bevan was right. So a simple
[code=thinbasic]
INI_GetKey(app_sourcepath & "Clock.ini", "Setup", "Mininumpregametime", "")
[/code]
was not returning anything.
The difference between INI_GetSectionsList or INI_GetSectionKeyList function and INI_GetKey is that INI_GetSectionsList and INI_GetSectionKeyList are home made functions while INI_GetKey is a wrapper of GetPrivateProfileString API function.
To get it short, the problem seems ini file name. If ini file name is "CLOCK.INI" GetPrivateProfileString seems to try to take data from somewhere else file or place while using something like the following where ini file name is NOT CLOCK.INI:
[code=thinbasic]
INI_GetKey(app_sourcepath & "_Clock.ini", "Setup", "Mininumpregametime", "")
[/code]
all is working as expected. Note that here we are specifing full ini file path and not just the file name so no way to confuse with other files around.
Does anyone have an idea why? I was not able to find info on Microsoft docs. At this point I suppose CLOCK.INI is a reserved name.
Thanks
Eros
Bookmarks