Documention for: parse-ini.r
Created by: sunanda
on: 3-Oct-2003
Last updated by: sunanda on: 12-Nov-2003
Format: html
Downloaded on: 30-Apr-2025

Windows INI file parser

Sunanda
October 2003

Contents

1. Overview
1.1 parse-ini-file
1.2 find-in-ini
1.3 Examples

1. Overview

A Windows ini file has this structure:

 [section-name1]
 keyword1=somevalue
 keyword2=someothervalue
 [section-name2]
 keyword3=yetanothervalue

There may be many sections, and each will have zero or more keywords.

The two functions in this script are:

1.1 parse-ini-file

Takes a whole ini file and converts it to a REBOL hash structure:

 ["section-name" ["keyword1" "somevalue" "keyword2" ...] ...]

1.2 find-in-ini

Return a value from an ini file. Returns false if the section and keyword do not exist.

1.3 Examples

 ini: parse-ini-file %/c/windows/win.ini

 print find-in-ini ini "ports" "com1:"
 print find-in-ini ini "intl" "iCountry"
 print find-in-ini ini "truetype" "FontSmoothing"
 print find-in-ini ini "xxx" "xxxx"