Issue with some ini functions

Started by Robert Eaton, July 09, 2010, 09:18:41 AM

Previous topic - Next topic

Robert Eaton

It seems that for a couple of functions that parse through the ini file, the string read from the file isn't trimmed before being tested. For example FF_INI_GetSectionsList will miss a section that has a space after the right bracket.


Rolf Brandt

#1
You are right, Robert.

This is code in the Functions Librarey that causes the effect:

     Line Input #FileID, InputData
     If (Left$(InputData, 1) = "[") And (Right$(InputData, 1) = "]") Then

InputData needs to be trimmed befor processing. If you change the code to this:

     Line Input #FileID, InputData
     InputData = Trim$(InputData)
     If (Left$(InputData, 1) = "[") And (Right$(InputData, 1) = "]") Then

... then it works as expected.

The same would apply for
FF_INI_GetTotalSections
FF_INI_GetTotalKeys
FF_INI_GetSectionKeyList
FF_INI_GetSectionTotalKeys
FF_INI_LineIsSection
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Paul Squires

The code for the ini functions is very old. Actually, I didn't even write them. I believe that Paul Noble supplied them way back in th every early days of FF1.
Paul Squires
PlanetSquires Software

Roger Garstang

In the WinMobile and .NET worlds Microsoft has completely dropped them all together and went to XML.  I still like INI type files though for simple stuff where XML is bloated. I even store raw Data/Types often in files too.