ReadIni$

System function.

The ReadIni$ function reads a parameter in the specified INI file. Not available in WinTask Lite.

Usage

An INI file is easy to manage when external data have to be shared with one or several scripts. Data are organized properly and ReadIni$ function accesses directly the desired data without dealing with read pointers, End Of File character, record separator character, ...

Syntax

var$=Readini$(<filename>,<Section>,<Item>,<Default>)

Parameters

<filename>: string; INI file to be read. It is a string which can be a constant or a variable. UNC names are accepted. If the path is not specified, the file is searched in the Windows directory.

<Section>: string, section to be read from the INI file.

<Item>: string, item to be read from the INI file.

Return value

Var$: return value, string containing the desired parameter from the INI file.

If the file <filename> or the section <Section> or the item <Item> do not exist, the value <Default> is returned.

See also

WriteIni

Example

Assume SAMPLE.INI contains:

[Section1]
Item1 = 123
Item2 =

 

var$=ReadIni$("sample.ini", "Section1","Item1","Default")
Returns "123" in var$

 

var$=ReadIni$("sample.ini", "Section1","Item2","Default")
Returns an empty string ("") in var$

 

var$=ReadIni$("sample.ini", "Section2","Item2","Default")
Returns "Default" in var$