>You don't need space(40)+chr(0). Open the ini file directly using fopen() and traverse it using fgets(). Use a case statement to check the left side of the = sign i.e.
Well, the purpose of the function was to use GetPrivateProfileString(). Sergey provided the fix to read long strings.