Page 1 of 1 1
Topic Options
#141171 - 2005-06-07 04:55 PM ReadProfileString limitations?
YaleCoder Offline
Getting the hang of it

Registered: 2001-12-18
Posts: 61
Loc: Jelenia Gora, Poland
Are there limitiations on the number of sections (or size of the array) that ReadProfileString can process? I am reading a huge file, almost 8500 sections, and I get an error that the expression when the code reaches
$fSectList = ReadProfileString($fSrcFile, $fSectName, '').

If I try to read a shorter file, the codeworks fine. I am using Kix 4.22 and the ini file I am trying to read is here http://castlecops.com/startuplist.php

Thanks
_________________________
"When fascism comes to America, it will be wrapped in the flag, carrying a cross."
Sinclair Lewis

Top
#141172 - 2005-06-07 05:05 PM Re: ReadProfileString limitations?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Which post/cross-post are we supposed to answer??

ReadProfileString limitations?
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#141173 - 2005-06-09 05:04 AM Re: ReadProfileString limitations?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Windows 9x/ME has a 64k file size limitation for .INI files. Are you sure it's not a syntax limitation? Why do you cross-post if we already try to help you in your other post? A .INI file is absolutely inefficient to deal with 8500 sections.
_________________________
There are two types of vessels, submarines and targets.

Top
#141174 - 2005-06-09 05:52 AM Re: ReadProfileString limitations?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
depends what you consider efficient.
and what the purpose and type of usage for the ini is.
_________________________
!

download KiXnet

Top
#141175 - 2005-06-09 06:01 AM Re: ReadProfileString limitations?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
As we all know, READPROFILESTRING has to read the complete file, sounds inefficient to me then with that size.
_________________________
There are two types of vessels, submarines and targets.

Top
#141176 - 2005-06-09 07:13 AM Re: ReadProfileString limitations?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well...
actual, that well known knowledge is little not that well known.
as logic says and as there are no real evidence to proof otherwise, I don't think it actually does that.

kixtart readprofilestring is just an export of:
http://msdn.microsoft.com/library/en-us/sysinfo/base/getprivateprofilestring.asp

and basically...
well, the function basically just opens the file and scans it for what you ask.
when you don't specify section, it is forced to obviously read the whole file.
but otherwise, I don't think it does that.

way or the other, for some purposes and types of uses, this type of large ini file is loooooot more efficient than any database or similar thingie.
_________________________
!

download KiXnet

Top
#141177 - 2005-06-10 01:07 AM Re: ReadProfileString limitations?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Opening and scanning a large file still takes a significant amount of time. Just try to create a large .INI file and measure the scan speeds, especially if the section/key is towards the end of the file.
_________________________
There are two types of vessels, submarines and targets.

Top
#141178 - 2005-06-10 01:11 AM Re: ReadProfileString limitations?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sure, but same happens for any file format, you can't help that.
the effect can be reduced but anyways, it's still there.
_________________________
!

download KiXnet

Top
#141179 - 2005-06-10 02:40 AM Re: ReadProfileString limitations?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
There are also limits to what can be stored in the Registry too.

Quote:

Note There is a 64K limit for the total size of all values of a key




Description of the Microsoft Windows registry
 

Top
#141180 - 2005-06-10 03:17 AM Re: ReadProfileString limitations?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
think that limit might also be gone in some windows versions...
_________________________
!

download KiXnet

Top
#141181 - 2005-06-10 09:02 AM Re: ReadProfileString limitations?
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I think that Jens is implying that the file should still be split, even if there is a work-around to enumerate it.

It depends of course on how you are going to use the file, but generally accessing (say) ten 100KB ini files is going to be far more efficient than accessing a single 1MB file.

Use a simple modulo hash to determine which file to place the section in.

Top
#141182 - 2005-06-10 09:16 AM Re: ReadProfileString limitations?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
well, in this case, as the other thread shows, hi is out of options.
he seems to have some sorta av or spyware tool that does store stuff in ini-file.
and he wants to play with it.

but, I agree that at some point, the simple readprofilestring approach may become rather... slow.
is it worth changing the approach, who knows.
after all, in many cases ini-file methods are just used because they are easy.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 641 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.055 seconds in which 0.034 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org