OmYcroN Posted May 16, 2009 Share Posted May 16, 2009 Hi. I'm using IniReadSection() to read some data and i have 440 values in the ini file. The returning array shows me only 435. What it's happening? It's the max size for the returning array ? Link to comment Share on other sites More sharing options...
Mat Posted May 16, 2009 Share Posted May 16, 2009 (edited) Only the first 32767 chars are taken in account in an section due to Win9x compatibility.Is that it? How big is the file? if its smaller than 30kb then ignore me.MDiesel Edited May 16, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
OmYcroN Posted May 16, 2009 Author Share Posted May 16, 2009 Is that it? How big is the file? if its smaller than 30kb then ignore me.MDieselAnd if i want to "brake" that compatibility ? Link to comment Share on other sites More sharing options...
Mat Posted May 16, 2009 Share Posted May 16, 2009 (edited) umm... Split up the file into seperate sections, 2 sections of 200 should do. I you don't want to do that then... Write your own function! Shouldn't be too hard: For $i = 1 to FileGetLines ($sIni) If StringLeft (FileReadLine ($i), 1) = "[" Then; is key $Start = $i ExitLoop EndIf Next If $Start = "" Then Return SetError (1, 0, 0) For $i = $Start + 1 To FileGetLines ($sIni) If StringLeft (FileReadLine ($i), 1) = "[" Then; is key $End = $i ExitLoop EndIf Next If $End = "" Then $End = FileGetLines ($sIni) For $i = $Start + 1 To $End - 1 $Line = Filereadline ($i) $Split = StringSplit ($line, "=") If $Split[0] <> 2 then Return SetError (1, 0, 0) ;;;; Next basic code, and untested, but you get the idea. Edited May 16, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 16, 2009 Share Posted May 16, 2009 The problem is that AutoIt currently uses the Windows API for reading INI files. Windows has that limitation. Link to comment Share on other sites More sharing options...
OmYcroN Posted May 16, 2009 Author Share Posted May 16, 2009 umm... Split up the file into seperate sections, 2 sections of 200 should do. I you don't want to do that then... Write your own function! Shouldn't be too hard: For $i = 1 to FileGetLines ($sIni) If StringLeft (FileReadLine ($i), 1) = "[" Then; is key $Start = $i ExitLoop EndIf Next For $i = $Start + 1 To FileGetLines ($sIni) If StringLeft (FileReadLine ($i), 1) = "[" Then; is key $End = $i ExitLoop EndIf Next For $i = $Start + 1 To $End - 1 $Line = Filereadline ($i) $Split = StringSplit ($line, "=") If $Split[0] <> 2 then Return SetError (1, 0, 0) ;;;; Next basic code, and untested, but you get the idea. So it's 32767 chars per section ? Or per file ? Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 16, 2009 Share Posted May 16, 2009 Per file. Link to comment Share on other sites More sharing options...
Mat Posted May 16, 2009 Share Posted May 16, 2009 (edited) So it's 32767 chars per section ? Or per file ?I don't know, I just happened to be doing this today (messing around with ini's) and I saw the limit. When you posted, I replied with an answer. I am presuming its section though, try it, if it works then it works! There you go then!@RichDo you have a link to the page where it gives the commands? I can only find stuff on fmapi's, which is not right.MDiesel Edited May 16, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
OmYcroN Posted May 16, 2009 Author Share Posted May 16, 2009 The problem is that AutoIt currently uses the Windows API for reading INI files. Windows has that limitation.I see ... Thanks for this info. Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 16, 2009 Share Posted May 16, 2009 Do you mean the native INI reading? I can look. Link to comment Share on other sites More sharing options...
Mat Posted May 16, 2009 Share Posted May 16, 2009 yup, I've searched msdn, but found little. I was probably looking in the wrong place as usual... AutoIt Project Listing Link to comment Share on other sites More sharing options...
OmYcroN Posted May 16, 2009 Author Share Posted May 16, 2009 Do you mean the native INI reading? I can look.I understand that inireadsection() reads a max of 32767 chars.So i use n sections for n * 32767 chars. Right ? Link to comment Share on other sites More sharing options...
Mat Posted May 16, 2009 Share Posted May 16, 2009 quote Richard = "per file" MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 16, 2009 Share Posted May 16, 2009 (edited) http://msdn.microsoft.com/en-us/library/ms724353(VS.85).aspxThis function, GetPrivateProfileString, is probably it. I assume that since it hasn't been rewritten to avoid this limit, that it still uses this.It doesn't say anything about the limit other than saying that it was kept for 16 bit app compatibility. 16 bit addresses could only address 65535 locations, and half of that minus one is 32767 (two's compliment). That's my guess..? Edited May 16, 2009 by Richard Robertson Link to comment Share on other sites More sharing options...
Inverted Posted May 17, 2009 Share Posted May 17, 2009 You could be a little more economical with the variable names to stay under the character limit, or get rid of comments/spaces/unused stuff. If it's your ini of course :-D Link to comment Share on other sites More sharing options...
Mat Posted May 17, 2009 Share Posted May 17, 2009 Thanks rich! That looks like its right. MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now