Thanks, that also explains the curious IniRead (AHK v1) behaviour.
GetPrivateProfileString function | Microsoft Docs
https://docs.microsoft.com/en-gb/window ... filestring
Avoid specifying a default string with trailing blank characters. The function inserts a null character in the lpReturnedString buffer to strip any trailing blanks.
Note: GetPrivateProfileString appears to trim trailing spaces but not tabs or any other characters.
Code: Select all
;test IniRead default strings (tested on AHK v2.0-a099)
vPath := "", vOutput := ""
Loop 65535
{
vDefault := "abc" Chr(A_Index)
vRet := IniRead(vPath, "Section", "NonExistentKey", vDefault)
if !(vDefault = vRet)
vOutput .= A_Index "`r`n"
}
Clipboard := vOutput
MsgBox(vOutput) ;32 ;only trailing spaces appear to be trimmed
return