mIRC Home    About    Download    Register    News    Help

Print Thread
Maximum length of line in an ini file #269240 27/07/21 04:57 PM
Joined: Dec 2020
Posts: 13
D
del Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Dec 2020
Posts: 13
I'd like to know what the max. length of a line is that can be stored in an *.ini or whatever you call that file and mIRC is able to handle?

Re: Maximum length of line in an ini file [Re: del] #269251 29/07/21 01:16 PM
Joined: Jan 2004
Posts: 1,606
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,606
It doesn't appear that there's a realistic limitation. This example shows creating a test.ini that has more than 30k bytes because it's using a codepoint which encodes each character as 3 bytes:

//var %a $str($chr(10004),$maxlenl) $+ a | if ($isfile(test.ini)) remove test.ini | writeini test.ini section item %a | echo -a $readini(test.ini,section,item) | echo -a $file(test.ini).size

Any problem you encounter will probably relate to the $maxlenl value for the mIRC version trying to run your code, which is 10k now, but up through v7.52 was around 4k-ish.

As long as you're able to get your value string placed into a %variable, you should be able to /writeini it, and should be able to readini it unless you're moving an absurdly long string into a really long variable name.

https://forums.mirc.com/ubbthreads.php/topics/265243/maxlenl-chars-vs-bytes mentions some issues it's possible to encounter unrelated to write/ini/readini, where sometimes $maxlenl is a character limit and sometimes it's the number of bytes. i.e. "//var %a $str($chr(10004),5000) | echo -a $sha256(%a) vs $sha256(%a $+ x)" returns the same hash twice because only the first 100+$maxlenl characters are being hashed so neither is for the 5000 char string, and there's a line-too-long error for "//var %a $regsubex(foo,$str($chr(10004),5000),,,&v) | echo -a $bvar(&v,0)" when the number of characters exceeds 100+$maxlenl, which at the current version is changing 5000 chars to 3447 or higher.