1inifile(n) Parsing of Windows INI files inifile(n)
2
3
4
5______________________________________________________________________________
6
8 inifile - Parsing of Windows INI files
9
11 package require Tcl 8.2
12
13 package require inifile ?0.2?
14
15 ::ini::open file ?mode?
16
17 ::ini::close ini
18
19 ::ini::commit ini
20
21 ::ini::revert ini
22
23 ::ini::filename ini
24
25 ::ini::sections ini
26
27 ::ini::keys ini section
28
29 ::ini::get ini section
30
31 ::ini::exists ini section ?key?
32
33 ::ini::value ini section key ?default?
34
35 ::ini::set ini section key value
36
37 ::ini::delete ini section ?key?
38
39 ::ini::comment ini section ?key? ?text?
40
41 ::ini::commentchar ?char?
42
43_________________________________________________________________
44
46 This package provides an interface for easy manipulation of Windows INI
47 files.
48
49 ::ini::open file ?mode?
50 Opens an INI file and returns a handle that is used by other
51 commands. Mode has the same types as the open command, with the
52 exception that mode a is not supported. The default mode is r+.
53
54 ::ini::close ini
55 Close the specified handle. If any changes were made and not
56 written by commit they are lost.
57
58 ::ini::commit ini
59 Writes the file and all changes to disk. The sections are writ‐
60 ten in arbitrary order. The keys in a section are written in
61 alphabetical order. If the ini was opened in read only mode an
62 error will be thrown.
63
64 ::ini::revert ini
65 Rolls all changes made to the inifile object back to the last
66 committed state.
67
68 ::ini::filename ini
69 Returns the name of the file the ini object is associated with.
70
71 ::ini::sections ini
72 Returns a list of all the names of the existing sections in the
73 file handle specified.
74
75 ::ini::keys ini section
76 Returns a list of all they key names in the section and file
77 specified.
78
79 ::ini::get ini section
80 Returns a list of key value pairs that exist in the section and
81 file specified.
82
83 ::ini::exists ini section ?key?
84 Returns a boolean value indicating the existance of the speci‐
85 fied section as a whole or the specified key within that sec‐
86 tion.
87
88 ::ini::value ini section key ?default?
89 Returns the value of the named key and section. If specified,
90 the default value will be returned if the key does not exist. If
91 the key does not exist and no default is specified an error will
92 be thrown.
93
94 ::ini::set ini section key value
95 Sets the value of the key in the specified section. If the sec‐
96 tion does not exist then a new one is created.
97
98 ::ini::delete ini section ?key?
99 Removes the key or the entire section and all its keys.
100
101 ::ini::comment ini section ?key? ?text?
102 Reads and modifies comments for sections and keys. To write a
103 section comment use an empty string for the key. To remove all
104 comments use an empty string for text. text may consist of a
105 list of lines or one single line. Any embedded newlines in text
106 are properly handled. Comments may be written to nonexistant
107 sections or keys and will not return an error. Reading a comment
108 from a nonexistant section or key will return an empty string.
109
110 ::ini::commentchar ?char?
111 Reads and sets the comment character. Lines that begin with this
112 character are treated as comments. When comments are written out
113 each line is preceded by this character. The default is ;.
114
115
116
117inifile 0.1.1 inifile(n)