Home > Language Reference > File Functions > WriteIni

WriteIni

The WriteIni function writes an entry in the specified INI file.

Usage

An INI file is easy to manage when external data have to be shared by other scripts. WriteIni function accesses directly the desired data without dealing with write pointers, End Of File character, record separator character, etc.

Syntax

ret=WriteIni(<filename>, <section>, <item>, <value>)

Parameters

<filename>, string, name of the  ini file. If the path is not specified, the file is searched in the Windows folder.

<section>, string, section where to write. If the <section> does not exist, it is created.

<item>, string, item where to write. If the <item> does not exist, it is created.

<value>, string. It contains the data to write in the INI file.

Return value

ret, optional numeric return value. If the function succeeds, the return value is 0. If the function fails, the return value is a nonzero value (see File Functions Error Codes).

See also

ReadIni

Example

WriteIni("c:\wttest\sample.ini", "Section1","Item1","123")
When done, SAMPLE.INI looks like this :
[Section1]
...
Item1 = 123
...