Using INI files => libini

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

Post Reply
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil
Has thanked: 100 times
Been thanked: 182 times

Using INI files => libini

Post by Pablo César »

Collecting experiences and sharing...

Our code for INI files is based on Grigory Filatov and Janusz Pora code.

Is got to mention that its support for types:

Character/Memo, Numeric, Date, Logical, Array and CodeBlocks too :)

_GetIni brings in that kind of types but is very important to previous create all variables or in arrays accordingly it types and values (not just declared neither as Nil). Otherwise aways will bring as character or most probably without empty value.

Normally we use like this:

Code: Select all

BEGIN INI FILE (cExeFPath + "Stru.ini")
      GET cFixedLang SECTION "Default" ENTRY "Language"
      GET cRDD       SECTION "Default" ENTRY "RDD"
      GET cBorders   SECTION "Default" ENTRY "Borders"
      GET cBPreview  SECTION "Default" ENTRY "Preview"
I have recently used like this:

Code: Select all

BEGIN INI FILE (cExeFPath + "Stru.ini")
      cFixedLang := _GetIni( "Default", "Language",, cFixedLang )
      cRDD       := _GetIni( "Default", "RDD",, cRDD )
      cBorders   := _GetIni( "Default", "Borders",, cBorders )
      cBPreview  := _GetIni( "Default", "Preview",, cBPreview )
This way I force the right use I in the parameter not informed I culd let a default value when its return back a empty value.

Leaving registered the tip ! I hope be useful. :D
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein

Post Reply