mIRC Homepage
Posted By: Kylar $readini return value is wrong. - 04/11/10 11:53 PM
Hey,

When you pass item names with multiple words to $readini, the extra words are appended to the result:
Code:
//echo -a $readini(file, n, section, item)
value

//echo -a $readini(file, n, section, item extra stuff)
value extra stuff

The expected behaviour is to use "item" as the item name and not append " extra stuff" to the result.

I'm using version 7.14.


Thanks.
Posted By: starbucks_mafia Re: $readini return value is wrong. - 05/11/10 12:50 AM
The current behaviour could well be considered a bug, I'm not sure I agree with your 'expected' behaviour though. I would expect it to return $null as there is no item "item extra stuff".
Posted By: argv0 Re: $readini return value is wrong. - 06/11/10 07:11 AM
What starbucks_mafia said is more accurate. If you use "item extra sutff" as your item name, mIRC should search for the item named "item extra stuff" and return $null, not search for "item".

The lack of support for spaces in item names is an implementation limitation, not a design limitation. It is theoretically possible for an item name to contain spaces with proper escaping or quoting, it's just not implemented currently. Since there is no standard for ini files, there's no reason why mIRC can't extend support for item names with spaces in a future version. This functionality should be therefore reserved for future use, which means relying on searching just the first word would/could break things in an update.
Posted By: Kylar Re: $readini return value is wrong. - 06/11/10 09:32 AM
Right. Using "item extra stuff" as the item name makes much more sense, even if /writeini doesn't support item names with spaces yet.
Posted By: x64 Re: $readini return value is wrong. - 08/11/10 09:06 AM
This is obviously a holdover from when $read and $readini didn't use parenthesis, which made it impossible for the item name to have spaces. For example:

set %blah $readini file.ini group item more things on this line

I'm willing to bet the original code for this function just appends the rest of the line to the output as it used to.
© mIRC Discussion Forums